code: public static function limit(Iterator $iterator, int $limitSize) : Iterator
      {
          Preconditions::checkArgument(0 <= $limitSize);
          return new NoRewindNecessaryLimitIterator($iterator, $limitSize);
      }
docs: Creates an iterator returning the first limitSize elements of the given iterator.
  If the original iterator does not contain that many elements,
  the returned iterator will have the same behavior as the original iterator.
  
  @param Iterator $iterator
  @param int $limitSize
  @return Iterator
  @throws \InvalidArgumentException if $limit is negative