public static <T> Iterable<List<T>> partition(final Iterable<T> iterable, final int size) {
    checkNotNull(iterable);
    checkArgument(size > 0);
    return new FluentIterable<List<T>>() {
      @Override
      public Iterator<List<T>> iterator() {
        return Iterators.partition(iterable.iterator(), size);
      }
    };
  }
public static <T> Iterable<List<T>> partition(final Iterable<T> iterable, final int size) {
    checkNotNull(iterable);
    checkArgument(size > 0);
    return new FluentIterable<List<T>>() {
      @Override
      public Iterator<List<T>> iterator() {
        return Iterators.partition(iterable.iterator(), size);
      }
    };
  }
public static < T > Iterable < List < T > > partition ( final Iterable < T > iterable , final int size ) { checkNotNull ( iterable ) ; checkArgument ( size > 0 ) ; return new FluentIterable < List < T > > ( ) { @ Override public Iterator < List < T > > iterator ( ) { return Iterators . partition ( iterable . iterator ( ) , size ) ; } } ; }
Divides an iterable into unmodifiable sublists of the given size (the final iterable may be
smaller). For example, partitioning an iterable containing {@code [a, b, c, d, e]} with a
partition size of 3 yields {@code [[a, b, c], [d, e]]} -- an outer iterable containing two
inner lists of three and two elements, all in the original order.

<p>Iterators returned by the returned iterable do not support the {@link Iterator#remove()}
method. The returned lists implement {@link RandomAccess}, whether or not the input list does.

<p><b>Note:</b> if {@code iterable} is a {@link List}, use {@link Lists#partition(List, int)}
instead.

@param iterable the iterable to return a partitioned view of
@param size the desired size of each partition (the last may be smaller)
@return an iterable of unmodifiable lists containing the elements of {@code iterable} divided
into partitions
@throws IllegalArgumentException if {@code size} is nonpositive
Divides an iterable into unmodifiable sublists of the given size ( the final iterable may be smaller ) . For example partitioning an iterable containing { @code [ a b c d e ] } with a partition size of 3 yields { @code [[ a b c ] [ d e ]] } -- an outer iterable containing two inner lists of three and two elements all in the original order .