src/precore/util/Iterables.php
public static function partition(IteratorAggregate $iterable, int $size) : IteratorAggregate
    {
        return FluentIterable::from(Iterators::partition(Iterators::from($iterable->getIterator()), $size))
            ->transform(
                function (Iterator $element) {
                    return new CallableIterable(
                        function () use ($element) {
                            return $element;
                        }
                    );
                }
            );
    }
public static function partition(IteratorAggregate $iterable, int $size) : IteratorAggregate
    {
        return FluentIterable::from(Iterators::partition(Iterators::from($iterable->getIterator()), $size))
            ->transform(
                function (Iterator $element) {
                    return new CallableIterable(
                        function () use ($element) {
                            return $element;
                        }
                    );
                }
            );
    }
public static function partition ( IteratorAggregate $ iterable , int $ size ) : IteratorAggregate { return FluentIterable :: from ( Iterators :: partition ( Iterators :: from ( $ iterable -> getIterator ( ) ) , $ size ) ) -> transform ( function ( Iterator $ element ) { return new CallableIterable ( function ( ) use ( $ element ) { return $ element ; } ) ; } ) ; }
Divides an iterable into unmodifiable sublists of the given size (the final iterable may be smaller).

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

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