@FunctionalInterface public interface OptionalDoubleToLongFunction extends DoubleFunction<OptionalLong>
DoubleToLongFunction
that returns OptionalLong
instead of the raw value. OptionalDoubleToLongFunction
is typically obtained from ExceptionHandler.fromDoubleToLongFunction(DoubleToLongFunction)
, in which case its return value is empty when the underlying DoubleToLongFunction
throws an exception. See noexception tutorial.
Modifier and Type | Method and Description |
---|---|
OptionalLong |
apply(double value)
Variation of DoubleToLongFunction.applyAsLong(double) that returns OptionalLong .
|
default DoubleToLongFunction |
orElse(long result)
Converts this OptionalDoubleToLongFunction to plain DoubleToLongFunction using default value.
|
default DoubleToLongFunction |
orElseGet(LongSupplier source)
Converts this OptionalDoubleToLongFunction to plain DoubleToLongFunction using fallback LongSupplier .
|
OptionalLong apply(double value)
DoubleToLongFunction.applyAsLong(double)
that returns OptionalLong
. If this OptionalDoubleToLongFunction
is obtained from ExceptionHandler.fromDoubleToLongFunction(DoubleToLongFunction)
, the OptionalLong
will be empty only if the underlying DoubleToLongFunction
throws. Otherwise the returned OptionalLong
just wraps the return value of underlying DoubleToLongFunction
.
apply
in interface DoubleFunction<OptionalLong>
value
- see DoubleToLongFunction.applyAsLong(double)
OptionalLong
typically wrapping return value of DoubleToLongFunction.applyAsLong(double)
, or an empty OptionalLong
(typically signifying an exception)
ExceptionHandler.fromDoubleToLongFunction(DoubleToLongFunction)
, DoubleToLongFunction.applyAsLong(double)
default DoubleToLongFunction orElse(long result)
OptionalDoubleToLongFunction
to plain DoubleToLongFunction
using default value. The returned DoubleToLongFunction
will unwrap present value from the OptionalLong
if possible, or return result
if the OptionalLong
is empty.
result
- default value to return instead of an empty OptionalLong
DoubleToLongFunction
that either unwraps OptionalLong
or returns default value
orElseGet(LongSupplier)
, OptionalLong.orElse(long)
default DoubleToLongFunction orElseGet(LongSupplier source)
OptionalDoubleToLongFunction
to plain DoubleToLongFunction
using fallback LongSupplier
. The returned DoubleToLongFunction
will unwrap present value from the OptionalLong
if possible, or fall back to calling source
if the OptionalLong
is empty.
source
- LongSupplier
to query for fallback value when OptionalLong
is empty
DoubleToLongFunction
that either unwraps OptionalLong
or falls back to source
orElse(long)
, OptionalLong.orElseGet(LongSupplier)
Copyright © 2017–2020 Robert Važan. All rights reserved.