@FunctionalInterface public interface OptionalBooleanSupplier extends Supplier<OptionalBoolean>
BooleanSupplier
that returns OptionalBoolean
instead of the raw value. OptionalBooleanSupplier
is typically obtained from ExceptionHandler.fromBooleanSupplier(BooleanSupplier)
, in which case its return value is empty when the underlying BooleanSupplier
throws an exception. See noexception tutorial.
Modifier and Type | Method and Description |
---|---|
OptionalBoolean |
get()
Variation of BooleanSupplier.getAsBoolean() that returns OptionalBoolean .
|
default BooleanSupplier |
orElse(boolean result)
Converts this OptionalBooleanSupplier to plain BooleanSupplier using default value.
|
default BooleanSupplier |
orElseGet(BooleanSupplier source)
|
OptionalBoolean get()
BooleanSupplier.getAsBoolean()
that returns OptionalBoolean
. If this OptionalBooleanSupplier
is obtained from ExceptionHandler.fromBooleanSupplier(BooleanSupplier)
, the OptionalBoolean
will be empty only if the underlying BooleanSupplier
throws. Otherwise the returned OptionalBoolean
just wraps the return value of underlying BooleanSupplier
.
get
in interface Supplier<OptionalBoolean>
OptionalBoolean
typically wrapping return value of BooleanSupplier.getAsBoolean()
, or an empty OptionalBoolean
(typically signifying an exception)
ExceptionHandler.fromBooleanSupplier(BooleanSupplier)
, BooleanSupplier.getAsBoolean()
default BooleanSupplier orElse(boolean result)
OptionalBooleanSupplier
to plain BooleanSupplier
using default value. The returned BooleanSupplier
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
BooleanSupplier
that either unwraps OptionalBoolean
or returns default value
orElseGet(BooleanSupplier)
, OptionalBoolean.orElse(boolean)
default BooleanSupplier orElseGet(BooleanSupplier source)
OptionalBooleanSupplier
to plain BooleanSupplier
using fallback BooleanSupplier
. The returned BooleanSupplier
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
BooleanSupplier
that either unwraps OptionalBoolean
or falls back to source
orElse(boolean)
, OptionalBoolean.orElseGet(BooleanSupplier)
Copyright © 2017–2020 Robert Važan. All rights reserved.