@FunctionalInterface public interface OptionalIntPredicate
IntPredicate
that returns OptionalBoolean
instead of the raw value. OptionalIntPredicate
is typically obtained from ExceptionHandler.fromIntPredicate(IntPredicate)
, in which case its return value is empty when the underlying IntPredicate
throws an exception. See noexception tutorial.
Modifier and Type | Method and Description |
---|---|
default IntPredicate |
orElse(boolean result)
Converts this OptionalIntPredicate to plain IntPredicate using default value.
|
default IntPredicate |
orElseGet(BooleanSupplier source)
|
OptionalBoolean |
test(int value)
Variation of IntPredicate.test(int) that returns OptionalBoolean .
|
OptionalBoolean test(int value)
IntPredicate.test(int)
that returns OptionalBoolean
. If this OptionalIntPredicate
is obtained from ExceptionHandler.fromIntPredicate(IntPredicate)
, the OptionalBoolean
will be empty only if the underlying IntPredicate
throws. Otherwise the returned OptionalBoolean
just wraps the return value of underlying IntPredicate
.
value
- see IntPredicate.test(int)
OptionalBoolean
typically wrapping return value of IntPredicate.test(int)
, or an empty OptionalBoolean
(typically signifying an exception)
ExceptionHandler.fromIntPredicate(IntPredicate)
, IntPredicate.test(int)
default IntPredicate orElse(boolean result)
OptionalIntPredicate
to plain IntPredicate
using default value. The returned IntPredicate
will unwrap present value from the OptionalBoolean
if possible, or return result
if the OptionalBoolean
is empty.
result
- default value to return instead of an empty OptionalBoolean
IntPredicate
that either unwraps OptionalBoolean
or returns default value
orElseGet(BooleanSupplier)
, OptionalBoolean.orElse(boolean)
default IntPredicate orElseGet(BooleanSupplier source)
OptionalIntPredicate
to plain IntPredicate
using fallback BooleanSupplier
. The returned IntPredicate
will unwrap present value from the OptionalBoolean
if possible, or fall back to calling source
if the OptionalBoolean
is empty.
source
- BooleanSupplier
to query for fallback value when OptionalBoolean
is empty
IntPredicate
that either unwraps OptionalBoolean
or falls back to source
orElse(boolean)
, OptionalBoolean.orElseGet(BooleanSupplier)
Copyright © 2017–2020 Robert Važan. All rights reserved.