code: public final Stream<T> track(@Nullable final AtomicLong counter,
              @Nullable final AtomicBoolean eof) {
          synchronized (this.state) {
              checkState();
              return new TrackStream<T>(this, counter, eof);
          }
      }
docs: Intermediate operation returning a Stream that returns the elements of this {@code Stream}
  and tracks the number of elements returned so far. As tracking the number elements has a
  small cost (due to {@code Iterator} and {@code Handler} wrapping, this feature must be
  explicitly requested and is not offered as part of the default feature set of
  {@code Stream}.
  
  @param counter
  the variable where to hold the number of returned elements, possibly null
  @param eof
  the variable where to store whether end of sequence has been reached, possibly
  null
  @return a {@code Stream} tracking the number of returned elements