src/precore/util/Iterators.php
public static function paddedPartition(Iterator $iterator, int $size) : Iterator
    {
        Preconditions::checkArgument(0 < $size);
        return new PartitionIterator($iterator, $size, true);
    }
public static function paddedPartition(Iterator $iterator, int $size) : Iterator
    {
        Preconditions::checkArgument(0 < $size);
        return new PartitionIterator($iterator, $size, true);
    }
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 inner lists of three elements each,
all in the original order.

@param Iterator $iterator
@param int $size
@return Iterator
@throws \InvalidArgumentException if $limit is non positive