Module com.machinezoo.noexception
Interface OptionalToLongBiFunction<T,U>
-
- Type Parameters:
-
T- seeToLongBiFunction -
U- seeToLongBiFunction
- All Superinterfaces:
-
BiFunction<T,U,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 OptionalToLongBiFunction<T,U> extends BiFunction<T,U,OptionalLong>
Variation ofToLongBiFunctionthat returnsOptionalLonginstead of the raw value.OptionalToLongBiFunctionis typically obtained fromExceptionHandler.fromToLongBiFunction(ToLongBiFunction), in which case its return value is empty when the underlyingToLongBiFunctionthrows an exception. See noexception tutorial.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description OptionalLongapply(T t, U u)Variation ofToLongBiFunction.applyAsLong(Object, Object)that returnsOptionalLong.default ToLongBiFunction<T,U>orElse(long result)Converts thisOptionalToLongBiFunctionto plainToLongBiFunctionusing default value.default ToLongBiFunction<T,U>orElseGet(LongSupplier source)-
Methods inherited from interface java.util.function.BiFunction
andThen
-
-
-
-
Method Detail
-
apply
OptionalLong apply(T t, U u)
Variation ofToLongBiFunction.applyAsLong(Object, Object)that returnsOptionalLong. If thisOptionalToLongBiFunctionis obtained fromExceptionHandler.fromToLongBiFunction(ToLongBiFunction), theOptionalLongwill be empty only if the underlyingToLongBiFunctionthrows. Otherwise the returnedOptionalLongjust wraps the return value of underlyingToLongBiFunction.- Specified by:
-
applyin interfaceBiFunction<T,U,OptionalLong> - Parameters:
-
t- seeToLongBiFunction.applyAsLong(Object, Object) -
u- seeToLongBiFunction.applyAsLong(Object, Object) - Returns:
-
OptionalLongtypically wrapping return value ofToLongBiFunction.applyAsLong(Object, Object), or an emptyOptionalLong(typically signifying an exception) - See Also:
-
ExceptionHandler.fromToLongBiFunction(ToLongBiFunction),ToLongBiFunction.applyAsLong(Object, Object)
-
orElse
default ToLongBiFunction<T,U> orElse(long result)
Converts thisOptionalToLongBiFunctionto plainToLongBiFunctionusing default value. The returnedToLongBiFunctionwill unwrap present value from theOptionalLongif possible, or returnresultif theOptionalLongis empty.- Parameters:
-
result- default value to return instead of an emptyOptionalLong - Returns:
-
plain
ToLongBiFunctionthat either unwrapsOptionalLongor returns default value - See Also:
-
orElseGet(LongSupplier),OptionalLong.orElse(long)
-
orElseGet
default ToLongBiFunction<T,U> orElseGet(LongSupplier source)
Converts thisOptionalToLongBiFunctionto plainToLongBiFunctionusing fallbackLongSupplier. The returnedToLongBiFunctionwill unwrap present value from theOptionalLongif possible, or fall back to callingsourceif theOptionalLongis empty.- Parameters:
-
source-LongSupplierto query for fallback value whenOptionalLongis empty - Returns:
-
plain
ToLongBiFunctionthat either unwrapsOptionalLongor falls back tosource - See Also:
-
orElse(long),OptionalLong.orElseGet(LongSupplier)
-
-