guava/src/com/google/common/collect/Streams.java
@Beta
  public static OptionalInt findLast(IntStream stream) {
    // findLast(Stream) does some allocation, so we might as well box some more
    java.util.Optional<Integer> boxedLast = findLast(stream.boxed());
    return boxedLast.isPresent() ? OptionalInt.of(boxedLast.get()) : OptionalInt.empty();
  }
@Beta
  public static OptionalInt findLast(IntStream stream) {
    // findLast(Stream) does some allocation, so we might as well box some more
    java.util.Optional<Integer> boxedLast = findLast(stream.boxed());
    return boxedLast.isPresent() ? OptionalInt.of(boxedLast.get()) : OptionalInt.empty();
  }
@ Beta public static OptionalInt findLast ( IntStream stream ) { // findLast(Stream) does some allocation, so we might as well box some more java . util . Optional < Integer > boxedLast = findLast ( stream . boxed ( ) ) ; return boxedLast . isPresent ( ) ? OptionalInt . of ( boxedLast . get ( ) ) : OptionalInt . empty ( ) ; }
Returns the last element of the specified stream, or {@link OptionalInt#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 IntStream#findFirst()
@throws NullPointerException if the last element of the stream is null
Returns the last element of the specified stream or { @link OptionalInt#empty } if the stream is empty .