@Beta
  public static OptionalLong findLast(LongStream stream) {
    // findLast(Stream) does some allocation, so we might as well box some more
    java.util.Optional<Long> boxedLast = findLast(stream.boxed());
    return boxedLast.isPresent() ? OptionalLong.of(boxedLast.get()) : OptionalLong.empty();
  }
@Beta
  public static OptionalLong findLast(LongStream stream) {
    
    java.util.Optional<Long> boxedLast = findLast(stream.boxed());
    return boxedLast.isPresent() ? OptionalLong.of(boxedLast.get()) : OptionalLong.empty();
  }
@ Beta public static OptionalLong findLast ( LongStream stream ) { // findLast(Stream) does some allocation, so we might as well box some more java . util . Optional < Long > boxedLast = findLast ( stream . boxed ( ) ) ; return boxedLast . isPresent ( ) ? OptionalLong . of ( boxedLast . get ( ) ) : OptionalLong . empty ( ) ; }
Returns the last element of the specified stream, or {@link OptionalLong#empty} if the stream
is empty.

<p>Equivalent to {@code stream.reduce((a, b) -> b)}, but may perform significantly better. This
method's runtime will be between O(log n) and O(n), performing better on <a
href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a>
streams.

@see LongStream#findFirst()
@throws NullPointerException if the last element of the stream is null
Returns the last element of the specified stream or { @link OptionalLong#empty } if the stream is empty .