src/precore/util/Iterators.php
public static function partition(Iterator $iterator, int $size) : Iterator
    {
        Preconditions::checkArgument(0 < $size);
        return new PartitionIterator($iterator, $size);
    }
public static function partition(Iterator $iterator, int $size) : Iterator
    {
        Preconditions::checkArgument(0 < $size);
        return new PartitionIterator($iterator, $size);
    }
public static function partition ( Iterator $ iterator , int $ size ) : Iterator { Preconditions :: checkArgument ( 0 < $ size ) ; return new PartitionIterator ( $ iterator , $ size ) ; }
Divides an iterator into unmodifiable sublists of the given size (the final list may be smaller).

For example, partitioning an iterator containing [a, b, c, d, e] with a partition size
of 3 yields [[a, b, c], [d, e]] -- an outer iterator containing two inner lists of three and two elements,
all in the original order.

@param Iterator $iterator
@param int $size
@return Iterator
@throws \InvalidArgumentException if $limit is non positive
Divides an iterator into unmodifiable sublists of the given size ( the final list may be smaller ) .