public final class OptBool extends Object
Optional<Boolean>
s.
This also saves memory by holding three static instances of
Optional<Boolean>
, which represents the possible states it can
have.
Modifier and Type | Field and Description |
---|---|
static Optional<Boolean> |
ABSENT
The absent value.
|
static Optional<Boolean> |
FALSE
The false value.
|
static Optional<Boolean> |
TRUE
The true value.
|
Modifier and Type | Method and Description |
---|---|
static Optional<Boolean> |
of(boolean bool)
Constructs a new
Optional<Boolean> from the given boolean. |
static Optional<Boolean> |
of(Boolean bool)
Constructs a new
Optional<Boolean> from the given Boolean . |
static Optional<Boolean> |
of(Optional<Boolean> bool)
Coerces the given
Optional<Boolean> into one of the three
stored states. |
public static Optional<Boolean> of(boolean bool)
Optional<Boolean>
from the given boolean.bool
- The booleanpublic static Optional<Boolean> of(@Nullable Boolean bool)
Optional<Boolean>
from the given Boolean
.bool
- The booleanOptional.empty()
public static Optional<Boolean> of(Optional<Boolean> bool)
Optional<Boolean>
into one of the three
stored states.bool
- The booleanOptional.empty()