Returns a fluent iterator returning elements of this fluent iterator grouped in chunks of $chunkSize
Returns the
@param int $chunkSize
@return $this
484993
public function batch($chunkSize)
    {
        $this->iterator = Iterators::batch($this->iterator, $chunkSize);
        return $this;
    }
1087598
public function chunk(int $size, bool $preserve_keys = false): CollectionInterface
    {
        $return = array_chunk($this->toArray(), $size, $preserve_keys);

        return static::make($return);
    }
236663
public function getIterator(): Iterator
    {
        $map = $this->map;
        foreach ($map as $ordinal => $value) {
            yield ($this->enumeration)::byOrdinal($ordinal) => $value;
        }
    }
174879
public function chunk(int $size): CollectionInterface
    {
        if ($size <= 0) {
            return new static();
        }

        $chunks = [];

        foreach (array_chunk($this->data->getValues(), $size, true) as $chunk) {
            $chunks[] = new static($chunk);
        }

        return new static($chunks);
    }
697988
public function batchSize(int $batchSize = 100): self
    {
        $this->batchSize = NumberUtils::bound($batchSize, 2, 100);
        return $this;
    }
866768
public function setChunkSize($size)
    {
        if(static::MODE == 'cli' && is_numeric($size))
        {
            $this->chunkSize = (int)$size;
        }
        elseif(static::MODE == 'web')
        {
            throw new Exception('Chunk size is not supported on web mode');
        }
        else
        {
            throw new Exception("$size is not a valid chunk size");
        }

        return $this;
    }
294803
public function pagesize($pagesize = null)
    {
        if ($pagesize === null) {
            return $this->options['pagesize'];
        } else {
            $this->options['pagesize'] = intval($pagesize);
            return $this;
        }
    }
1145427
private function initChunksIterator()
    {
        $cursor = $this->collectionWrapper->findChunksByFileId($this->file->_id, $this->chunkOffset);

        $this->chunksIterator = new IteratorIterator($cursor);
        $this->chunksIterator->rewind();
    }
1311784
public function chunk(int $size = 1): StreamInterface
    {
        $stream = new Stream(self::class);
        $string = $this;

        while ($string->length() > 0) {
            $stream = $stream->add($string->substring(0, $size));
            $string = $string->substring($size);
        }

        return $stream;
    }
1103211
public function sortedSetOf(): self
    {
        $obj = clone $this;
        usort($obj->_elements,
            function (Element $a, Element $b) {
                $a_der = $a->toDER();
                $b_der = $b->toDER();
                return strcmp($a_der, $b_der);
            });
        return $obj;
    }
600512
public function removeAllByChunks(EntityStorageInterface $storage, array $ids, $chunkSize = 10) {
    // Set appropriate chunk size.
    $default_chunk_size = 10;
    if ((int) $chunkSize <= 0) {
      $chunkSize = $default_chunk_size;
    }
    if (empty($ids)) {
      return;
    }
    $chunks = array_chunk($ids, $chunkSize);
    foreach ($chunks as $chunk) {
      $entities = $storage->loadMultiple($chunk);
      $storage->delete($entities);
    }
  }
972697
public function chunk($size): Collection
    {
        $chunks = [];

        foreach (array_chunk($this->items, (int) $size, true) as $chunk) {
            $chunks[] = new static($chunk);
        }

        return new static($chunks);
    }
1055299
public function pageSize($pageSize = null)
    {
        if ($pageSize === null) {
            return $this->_pageSize;
        }
        $this->_pageSize = $pageSize;

        return $this;
    }
1286107
public function size(string $size): self
    {
        $comparator = new Comparator\NumberComparator($size);
        $filter = new Iterator\SizeRangeFilterIterator($this->getIterator(), [$comparator]);

        return new self(iterator_to_array($filter));
    }
997513
public final Stream<List<T>> chunk(final int chunkSize) {
        synchronized (this.state) {
            checkState();
            return new ChunkStream<T>(this, chunkSize);
        }
    }
1119710
public function setBlocksize($blocksize)
    {
        if (($blocksize < 0) || ($blocksize > 9)) {
            throw new Exception\InvalidArgumentException('Blocksize must be between 0 and 9');
        }

        $this->options['blocksize'] = (int) $blocksize;
        return $this;
    }
615294
def chunks(self):
        
        if not hasattr(self, '_it'):
            class ChunkIterator(object):
                def __iter__(iter):
                    return iter

                def __next__(iter):
                    try:
                        chunk = self._next_chunk()
                    except StopIteration:
                        if self.loop:
                            self._init_stretching()
                            return iter.__next__()

                        raise

                    return chunk
                next = __next__

            self._it = ChunkIterator()

        return self._it