public OptionalLong max(Comparator<Long> comparator) {
        return reduce((a, b) -> comparator.compare(a, b) >= 0 ? a : b);
    }
public OptionalLong max ( Comparator < Long > comparator ) { return reduce ( ( a , b ) -> comparator . compare ( a , b ) >= 0 ? a : b ) ; }
Returns the maximum element of this stream according to the provided
{@code Comparator}.

<p>
This is a terminal operation.

@param comparator a non-interfering, stateless {@link Comparator} to
compare elements of this stream
@return an {@code OptionalLong} describing the maximum element of this
stream, or an empty {@code OptionalLong} if the stream is empty