Peek at the current value of the Future
<pre>
{@code
FutureT.of(AnyM.fromStream(Arrays.asFuture(10))
.peek(System.out::println);

//prints 10
}
</pre>

@param peek  Consumer to accept current value of Future
@return FutureT with peek call
483676
@Override
    public ReaderT<W,T,R> peek(final Consumer<? super R> peek) {
        return of(run.peek(reader -> reader.mapFn(a -> {
            peek.accept(a);
            return a;
        })));
    }
897895
static @Nullable <V> V getWhenSuccessful(@Nullable CompletableFuture<V> future) {
    try {
      return (future == null) ? null : future.get();
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      return null;
    } catch (ExecutionException e) {
      return null;
    }
  }
540445
@Override
    public Future<T> peek(final Consumer<? super T> c) {

        return (Future<T>) MonadicValue.super.peek(c);
    }
1072521
public final static <T> CompletableFuture<List<T>> streamToCompletableFuture(final Stream<T> stream) {
        return CompletableFuture.completedFuture(stream.collect(Collectors.toList()));

    }
34096
int peek() throws
      IOException
  {
    Mark m = mark();
    int ch = next();
    unread(ch, m);
    return ch;
  }
859600
@Contract(pure = true)
	public byte peekByte() {
		assert hasRemaining();
		ByteBuf buf = bufs[first];
		return buf.peek();
	}
1175434
@Override
    public E peek() {
        // Copy field to avoid re-reading after volatile load
        final AtomicReferenceArray<E> buffer = this.buffer;
        // LoadLoad
        final long cIndex = lpConsumerIndex();
        final int offset = calcElementOffset(cIndex);
        E e = lvElement(buffer, offset);
        if (null == e) {
            /*
             * NOTE: Queue may not actually be empty in the case of a producer (P1) being interrupted after
             * winning the CAS on offer but before storing the element in the queue. Other producers may go on
             * to fill up the queue after this element.
             */
            if (cIndex != lvProducerIndex()) {
                do {
                    e = lvElement(buffer, offset);
                } while (e == null);
            } else {
                return null;
            }
        }
        return e;
    }
776184
@Override
    public IPromise then(Callback resultCB) {
        // FIXME: this can be implemented more efficient
        while( !lock.compareAndSet(false,true) ) {}
        try {
            if (resultReceiver != null)
                throw new RuntimeException("Double register of promise listener");
            resultReceiver = resultCB;
            if (hadResult) {
                hasFired = true;
                if (nextFuture == null) {
                    nextFuture = new Promise(result, error);
                    lock.set(false);
                    resultCB.complete(result, error);
                } else {
                    lock.set(false);
                    resultCB.complete(result, error);
                    nextFuture.complete(result, error);
                    return nextFuture;
                }
            }
            if (resultCB instanceof IPromise) {
                return (IPromise) resultCB;
            }
            lock.set(false);
            while( !lock.compareAndSet(false,true) ) {}
            if (nextFuture == null) {
                return nextFuture = new Promise();
            } else {
                return nextFuture;
            }
        } finally {
            lock.set(false);
        }
    }
383259
private static <T> T get(final Future<T> future) throws SpannerException {
    final Context context = Context.current();
    try {
      return future.get();
    } catch (InterruptedException e) {
      // We are the sole consumer of the future, so cancel it.
      future.cancel(true);
      throw SpannerExceptionFactory.propagateInterrupt(e);
    } catch (ExecutionException | CancellationException e) {
      throw newSpannerException(context, e);
    }
  }
795890
public Long peek() throws InterruptedException {
        lock.lockInterruptibly();
        try {
            while (queue.size() == 0) {
                notEmpty.await();
            }

            return queue.peek();
        } finally {
            lock.unlock();
        }
    }
563383
public int peekRawUInt(int bits) throws IOException {
        int val = 0;
        for (int i = 0; i < bits; i++) {
            val = peekBitToInt(val, i);
        }
        return val;
    }
1056896
public Bits peek(final int bits) throws IOException {
    final int additionalBitsNeeded = bits - this.remainder.bitLength;
    final int additionalBytesNeeded = (int) Math.ceil(additionalBitsNeeded / 8.);
    if (additionalBytesNeeded > 0) this.readAhead(additionalBytesNeeded);
    return this.remainder.range(0, Math.min(bits, this.remainder.bitLength));
  }
414971
public synchronized int peekInt()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "peekInt");

      checkReleased();

      int result = 0;
      if (receivedBuffer != null)
      {
         int currentPosition = receivedBuffer.position();
         result = receivedBuffer.getInt();
         receivedBuffer.position(currentPosition);
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "peekInt", result);
      return result;
   }
609613
@Override
  public StreamBuilderImpl<T,U> peek(ConsumerSync<? super T> consumer)
  {
    return new Peek<T,U>(this, consumer);
  }
11508
@Override
  public Map<K, V> peekAll(final Iterable<? extends K> keys) {
    Map<K, CacheEntry<K, V>> map = new HashMap<K, CacheEntry<K, V>>();
    for (K k : keys) {
      CacheEntry<K, V> e = execute(k, SPEC.peekEntry(k));
      if (e != null) {
        map.put(k, e);
      }
    }
    return heapCache.convertCacheEntry2ValueMap(map);
  }
71338
public Promise getNext() {
        while( !lock.compareAndSet(false,true) ) {}
        try {
            if (nextFuture == null)
                return new Promise();
            else
                return (Promise) nextFuture;
        } finally {
            lock.set(false);
        }
    }
233338
Collection<FutureReadResultEntry> poll(long maxOffset) {
        List<FutureReadResultEntry> result = new ArrayList<>();
        synchronized (this.reads) {
            Exceptions.checkNotClosed(this.closed, this);

            // 'reads' is sorted by Starting Offset, in ascending order. As long as it is not empty and the
            // first entry overlaps the given offset by at least one byte, extract and return it.
            while (this.reads.size() > 0 && this.reads.peek().getStreamSegmentOffset() <= maxOffset) {
                result.add(this.reads.poll());
            }
        }

        return result;
    }