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