Divides an iterator into unmodifiable sublists of the given size, padding the final iterator with null values if necessary. For example, partitioning an iterator containing [a, b, c, d, e] with a partition size of 3 yields [[a, b, c], [d, e, null]] -- an outer iterator containing two
(Iterator<T> iterator, int size)
| 602 | |
| 603 | |
| 604 | public static <T> UnmodifiableIterator<List<T>> paddedPartition(Iterator<T> iterator, int size) { |
| 605 | return partitionImpl(iterator, size, true); |
| 606 | } |
| 607 | |
| 608 | private static <T> UnmodifiableIterator<List<T>> partitionImpl(final Iterator<T> iterator, final int size, final boolean pad) { |
| 609 | checkNotNull(iterator); |