public OptionalLong minByDouble(LongToDoubleFunction keyExtractor) {
        return collect(PrimitiveBox::new, (box, l) -> {
            double key = keyExtractor.applyAsDouble(l);
            if (!box.b || Double.compare(box.d, key) > 0) {
                box.b = true;
                box.d = key;
                box.l = l;
            }
        }, PrimitiveBox.MIN_DOUBLE).asLong();
    }
public OptionalLong minByDouble ( LongToDoubleFunction keyExtractor ) { return collect ( PrimitiveBox :: new , ( box , l ) -> { double key = keyExtractor . applyAsDouble ( l ) ; if ( ! box . b || Double . compare ( box . d , key ) > 0 ) { box . b = true ; box . d = key ; box . l = l ; } } , PrimitiveBox . MIN_DOUBLE ) . asLong ( ) ; }
Returns the minimum element of this stream according to the provided key
extractor function.

<p>
This is a terminal operation.

@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalLong} describing the first element of this
stream for which the lowest value was returned by key extractor,
or an empty {@code OptionalLong} if the stream is empty
@since 0.1.2