Module com.machinezoo.noexception
Interface OptionalDoublePredicate
-
- 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 OptionalDoublePredicate
Variation ofDoublePredicate
that returnsOptionalBoolean
instead of the raw value.OptionalDoublePredicate
is typically obtained fromExceptionHandler.fromDoublePredicate(DoublePredicate)
, in which case its return value is empty when the underlyingDoublePredicate
throws an exception. See noexception tutorial.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default DoublePredicate
orElse(boolean result)
Converts thisOptionalDoublePredicate
to plainDoublePredicate
using default value.default DoublePredicate
orElseGet(BooleanSupplier source)
OptionalBoolean
test(double value)
Variation ofDoublePredicate.test(double)
that returnsOptionalBoolean
.
-
-
-
Method Detail
-
test
OptionalBoolean test(double value)
Variation ofDoublePredicate.test(double)
that returnsOptionalBoolean
. If thisOptionalDoublePredicate
is obtained fromExceptionHandler.fromDoublePredicate(DoublePredicate)
, theOptionalBoolean
will be empty only if the underlyingDoublePredicate
throws. Otherwise the returnedOptionalBoolean
just wraps the return value of underlyingDoublePredicate
.- Parameters:
-
value
- seeDoublePredicate.test(double)
- Returns:
-
OptionalBoolean
typically wrapping return value ofDoublePredicate.test(double)
, or an emptyOptionalBoolean
(typically signifying an exception) - See Also:
-
ExceptionHandler.fromDoublePredicate(DoublePredicate)
,DoublePredicate.test(double)
-
orElse
default DoublePredicate orElse(boolean result)
Converts thisOptionalDoublePredicate
to plainDoublePredicate
using default value. The returnedDoublePredicate
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
DoublePredicate
that either unwrapsOptionalBoolean
or returns default value - See Also:
-
orElseGet(BooleanSupplier)
,OptionalBoolean.orElse(boolean)
-
orElseGet
default DoublePredicate orElseGet(BooleanSupplier source)
Converts thisOptionalDoublePredicate
to plainDoublePredicate
using fallbackBooleanSupplier
. The returnedDoublePredicate
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
DoublePredicate
that either unwrapsOptionalBoolean
or falls back tosource
- See Also:
-
orElse(boolean)
,OptionalBoolean.orElseGet(BooleanSupplier)
-
-