Module com.machinezoo.noexception
Interface OptionalBiPredicate<T,U>
-
- Type Parameters:
-
T
- seeBiPredicate
-
U
- seeBiPredicate
- 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 OptionalBiPredicate<T,U>
Variation ofBiPredicate
that returnsOptionalBoolean
instead of the raw value.OptionalBiPredicate
is typically obtained fromExceptionHandler.fromBiPredicate(BiPredicate)
, in which case its return value is empty when the underlyingBiPredicate
throws an exception. See noexception tutorial.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default BiPredicate<T,U>
orElse(boolean result)
Converts thisOptionalBiPredicate
to plainBiPredicate
using default value.default BiPredicate<T,U>
orElseGet(BooleanSupplier source)
OptionalBoolean
test(T t, U u)
Variation ofBiPredicate.test(Object, Object)
that returnsOptionalBoolean
.
-
-
-
Method Detail
-
test
OptionalBoolean test(T t, U u)
Variation ofBiPredicate.test(Object, Object)
that returnsOptionalBoolean
. If thisOptionalBiPredicate
is obtained fromExceptionHandler.fromBiPredicate(BiPredicate)
, theOptionalBoolean
will be empty only if the underlyingBiPredicate
throws. Otherwise the returnedOptionalBoolean
just wraps the return value of underlyingBiPredicate
.- Parameters:
-
t
- seeBiPredicate.test(Object, Object)
-
u
- seeBiPredicate.test(Object, Object)
- Returns:
-
OptionalBoolean
typically wrapping return value ofBiPredicate.test(Object, Object)
, or an emptyOptionalBoolean
(typically signifying an exception) - See Also:
-
ExceptionHandler.fromBiPredicate(BiPredicate)
,BiPredicate.test(Object, Object)
-
orElse
default BiPredicate<T,U> orElse(boolean result)
Converts thisOptionalBiPredicate
to plainBiPredicate
using default value. The returnedBiPredicate
will unwrap present value from theOptionalBoolean
if possible, or returnresult
if theOptionalBoolean
is empty.- Parameters:
-
result
- default value to return instead of an emptyOptionalBoolean
- Returns:
-
plain
BiPredicate
that either unwrapsOptionalBoolean
or returns default value - See Also:
-
orElseGet(BooleanSupplier)
,OptionalBoolean.orElse(boolean)
-
orElseGet
default BiPredicate<T,U> orElseGet(BooleanSupplier source)
Converts thisOptionalBiPredicate
to plainBiPredicate
using fallbackBooleanSupplier
. The returnedBiPredicate
will unwrap present value from theOptionalBoolean
if possible, or fall back to callingsource
if theOptionalBoolean
is empty.- Parameters:
-
source
-BooleanSupplier
to query for fallback value whenOptionalBoolean
is empty - Returns:
-
plain
BiPredicate
that either unwrapsOptionalBoolean
or falls back tosource
- See Also:
-
orElse(boolean)
,OptionalBoolean.orElseGet(BooleanSupplier)
-
-