title: What does <S extends T> List<S> save(Iterable<S> entities) mean
body: <p>Its in the <code>JpaRepository</code></p>
  
  <pre><code>    /*
   * Copyright 2008-2016 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.springframework.data.jpa.repository;
  
  import java.io.Serializable;
  import java.util.List;
  
  import javax.persistence.EntityManager;
  
  import org.springframework.data.domain.Example;
  import org.springframework.data.domain.Sort;
  import org.springframework.data.repository.NoRepositoryBean;
  import org.springframework.data.repository.PagingAndSortingRepository;
  import org.springframework.data.repository.query.QueryByExampleExecutor;
  
  /**
   * JPA specific extension of {@link org.springframework.data.repository.Repository}.
   *
   * @author Oliver Gierke
   * @author Christoph Strobl
   * @author Mark Paluch
   */
  @NoRepositoryBean
  public interface JpaRepository&lt;T, ID extends Serializable&gt;
          extends PagingAndSortingRepository&lt;T, ID&gt;, QueryByExampleExecutor&lt;T&gt; {
  
      /*
       * (non-Javadoc)
       * @see org.springframework.data.repository.CrudRepository#findAll()
       */
      List&lt;T&gt; findAll();
  
      /*
       * (non-Javadoc)
       * @see org.springframework.data.repository.PagingAndSortingRepository#findAll(org.springframework.data.domain.Sort)
       */
      List&lt;T&gt; findAll(Sort sort);
  
      /*
       * (non-Javadoc)
       * @see org.springframework.data.repository.CrudRepository#findAll(java.lang.Iterable)
       */
      List&lt;T&gt; findAll(Iterable&lt;ID&gt; ids);
  
      /*
       * (non-Javadoc)
       * @see org.springframework.data.repository.CrudRepository#save(java.lang.Iterable)
       */
      &lt;S extends T&gt; List&lt;S&gt; save(Iterable&lt;S&gt; entities);
  
      /**
       * Flushes all pending changes to the database.
       */
      void flush();
  
      /**
       * Saves an entity and flushes changes instantly.
       * 
       * @param entity
       * @return the saved entity
       */
      &lt;S extends T&gt; S saveAndFlush(S entity);
  
      /**
       * Deletes the given entities in a batch which means it will create a single {@link Query}. Assume that we will clear
       * the {@link javax.persistence.EntityManager} after the call.
       * 
       * @param entities
       */
      void deleteInBatch(Iterable&lt;T&gt; entities);
  
      /**
       * Deletes all entities in a batch call.
       */
      void deleteAllInBatch();
  
      /**
       * Returns a reference to the entity with the given identifier.
       * 
       * @param id must not be {@literal null}.
       * @return a reference to the entity with the given identifier.
       * @see EntityManager#getReference(Class, Object)
       */
      T getOne(ID id);
  
      /* (non-Javadoc)
       * @see org.springframework.data.repository.query.QueryByExampleExecutor#findAll(org.springframework.data.domain.Example)
       */
      @Override
      &lt;S extends T&gt; List&lt;S&gt; findAll(Example&lt;S&gt; example);
  
      /* (non-Javadoc)
       * @see org.springframework.data.repository.query.QueryByExampleExecutor#findAll(org.springframework.data.domain.Example, org.springframework.data.domain.Sort)
       */
      @Override
      &lt;S extends T&gt; List&lt;S&gt; findAll(Example&lt;S&gt; example, Sort sort);
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kZAFC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kZAFC.png" alt="enter image description here"></a></p>
  
  <p>I don't understand in combination, what this <code>save</code> ... defination is about? and the SO question answered here <a href="https://stackoverflow.com/questions/41960743/what-does-it-mean-s-extends-t-save-s-entity-in-spring-repository">What does it mean &lt;S extends T&gt; save (S entity); in Spring Repository?</a> was very confusing as its example with Both using T and confused me more with having <code>Dog</code> involved....</p>
  
  <p>Would anyone able to explain the whole phrase piece by piece and with maybe a small example when needed? </p>
  
  <p>Basically the use case is when I extended the JpaRepository. I wonder what exactly I can pass into this <code>.save</code> function, and by looking at this function defination here, I have no idea and not sure how to proceed to understand it better without have to digging through a lot more documentation for java and blog posts.</p>