List of usage examples for com.google.common.collect Iterators paddedPartition
public static <T> UnmodifiableIterator<List<T>> paddedPartition(Iterator<T> iterator, int size)
From source file:org.calrissian.mango.collect.CloseableIterators.java
/** * Divides a closeableiterator into unmodifiable sublists of the given size, padding * the final iterator with null values if necessary. For example, partitioning * a closeable iterator containing {@code [a, b, c, d, e]} with a partition size of 3 * yields {@code [[a, b, c], [d, e, null]]} -- an outer iterator containing * two inner lists of three elements each, all in the original order. * * <p>The returned lists implement {@link java.util.RandomAccess}. *//* w ww. j a v a2 s. co m*/ public static <T> CloseableIterator<List<T>> paddedParition(final CloseableIterator<T> iterator, final int size) { return wrap(Iterators.paddedPartition(iterator, size), iterator); }