Module com.machinezoo.noexception
Interface OptionalDoubleToLongFunction
-
- All Superinterfaces:
-
DoubleFunction<OptionalLong>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface OptionalDoubleToLongFunction extends DoubleFunction<OptionalLong>
Variation ofDoubleToLongFunctionthat returnsOptionalLonginstead of the raw value.OptionalDoubleToLongFunctionis typically obtained fromExceptionHandler.fromDoubleToLongFunction(DoubleToLongFunction), in which case its return value is empty when the underlyingDoubleToLongFunctionthrows an exception. See noexception tutorial.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description OptionalLongapply(double value)Variation ofDoubleToLongFunction.applyAsLong(double)that returnsOptionalLong.default DoubleToLongFunctionorElse(long result)Converts thisOptionalDoubleToLongFunctionto plainDoubleToLongFunctionusing default value.default DoubleToLongFunctionorElseGet(LongSupplier source)Converts thisOptionalDoubleToLongFunctionto plainDoubleToLongFunctionusing fallbackLongSupplier.
-
-
-
Method Detail
-
apply
OptionalLong apply(double value)
Variation ofDoubleToLongFunction.applyAsLong(double)that returnsOptionalLong. If thisOptionalDoubleToLongFunctionis obtained fromExceptionHandler.fromDoubleToLongFunction(DoubleToLongFunction), theOptionalLongwill be empty only if the underlyingDoubleToLongFunctionthrows. Otherwise the returnedOptionalLongjust wraps the return value of underlyingDoubleToLongFunction.- Specified by:
-
applyin interfaceDoubleFunction<OptionalLong> - Parameters:
-
value- seeDoubleToLongFunction.applyAsLong(double) - Returns:
-
OptionalLongtypically wrapping return value ofDoubleToLongFunction.applyAsLong(double), or an emptyOptionalLong(typically signifying an exception) - See Also:
-
ExceptionHandler.fromDoubleToLongFunction(DoubleToLongFunction),DoubleToLongFunction.applyAsLong(double)
-
orElse
default DoubleToLongFunction orElse(long result)
Converts thisOptionalDoubleToLongFunctionto plainDoubleToLongFunctionusing default value. The returnedDoubleToLongFunctionwill unwrap present value from theOptionalLongif possible, or returnresultif theOptionalLongis empty.- Parameters:
-
result- default value to return instead of an emptyOptionalLong - Returns:
-
plain
DoubleToLongFunctionthat either unwrapsOptionalLongor returns default value - See Also:
-
orElseGet(LongSupplier),OptionalLong.orElse(long)
-
orElseGet
default DoubleToLongFunction orElseGet(LongSupplier source)
Converts thisOptionalDoubleToLongFunctionto plainDoubleToLongFunctionusing fallbackLongSupplier. The returnedDoubleToLongFunctionwill unwrap present value from theOptionalLongif possible, or fall back to callingsourceif theOptionalLongis empty.- Parameters:
-
source-LongSupplierto query for fallback value whenOptionalLongis empty - Returns:
-
plain
DoubleToLongFunctionthat either unwrapsOptionalLongor falls back tosource - See Also:
-
orElse(long),OptionalLong.orElseGet(LongSupplier)
-
-