T
- see ToLongBiFunction
U
- see ToLongBiFunction
@FunctionalInterface public interface OptionalToLongBiFunction<T,U> extends BiFunction<T,U,OptionalLong>
ToLongBiFunction
that returns OptionalLong
instead of the raw value. OptionalToLongBiFunction
is typically obtained from ExceptionHandler.fromToLongBiFunction(ToLongBiFunction)
, in which case its return value is empty when the underlying ToLongBiFunction
throws an exception. See noexception tutorial.
Modifier and Type | Method and Description |
---|---|
OptionalLong |
apply(T t, U u)
Variation of ToLongBiFunction.applyAsLong(Object, Object) that returns OptionalLong .
|
default ToLongBiFunction<T,U> |
orElse(long result)
Converts this OptionalToLongBiFunction to plain ToLongBiFunction using default value.
|
default ToLongBiFunction<T,U> |
orElseGet(LongSupplier source)
|
andThen
OptionalLong apply(T t, U u)
ToLongBiFunction.applyAsLong(Object, Object)
that returns OptionalLong
. If this OptionalToLongBiFunction
is obtained from ExceptionHandler.fromToLongBiFunction(ToLongBiFunction)
, the OptionalLong
will be empty only if the underlying ToLongBiFunction
throws. Otherwise the returned OptionalLong
just wraps the return value of underlying ToLongBiFunction
.
apply
in interface BiFunction<T,U,OptionalLong>
t
- see ToLongBiFunction.applyAsLong(Object, Object)
u
- see ToLongBiFunction.applyAsLong(Object, Object)
OptionalLong
typically wrapping return value of ToLongBiFunction.applyAsLong(Object, Object)
, or an empty OptionalLong
(typically signifying an exception)
ExceptionHandler.fromToLongBiFunction(ToLongBiFunction)
, ToLongBiFunction.applyAsLong(Object, Object)
default ToLongBiFunction<T,U> orElse(long result)
OptionalToLongBiFunction
to plain ToLongBiFunction
using default value. The returned ToLongBiFunction
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
ToLongBiFunction
that either unwraps OptionalLong
or returns default value
orElseGet(LongSupplier)
, OptionalLong.orElse(long)
default ToLongBiFunction<T,U> orElseGet(LongSupplier source)
OptionalToLongBiFunction
to plain ToLongBiFunction
using fallback LongSupplier
. The returned ToLongBiFunction
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
ToLongBiFunction
that either unwraps OptionalLong
or falls back to source
orElse(long)
, OptionalLong.orElseGet(LongSupplier)
Copyright © 2017–2020 Robert Važan. All rights reserved.