code: @NotNull
      public LongStream limit(final long maxSize) {
          if (maxSize < 0) throw new IllegalArgumentException("maxSize cannot be negative");
          if (maxSize == 0) return LongStream.empty();
          return new LongStream(params, new LongLimit(iterator, maxSize));
      }
docs: Returns a stream consisting of the elements of this stream, truncated
  to be no longer than {@code maxSize} in length.
  
  <p> This is a short-circuiting stateful intermediate operation.
  
  <p>Example:
  <pre>
  maxSize: 3
  stream: [1, 2, 3, 4, 5]
  result: [1, 2, 3]
  
  maxSize: 10
  stream: [1, 2]
  result: [1, 2]
  </pre>
  
  @param maxSize  the number of elements the stream should be limited to
  @return the new stream
  @throws IllegalArgumentException if {@code maxSize} is negative