Package org.spongepowered.api.util
Class OptBool
java.lang.Object
org.spongepowered.api.util.OptBool
Utility for working with
Optional<Boolean>
s.
This also saves memory by holding three static instances of
Optional<Boolean>
, which represents the possible states it can
have.
-
Field Details
-
TRUE
The true value. -
FALSE
The false value. -
EMPTY
The absent value.Also a shorthand for constructing instances with
Optional.<Boolean>empty()
.
-
-
Method Details
-
of
Constructs a newOptional<Boolean>
from the given boolean.- Parameters:
bool
- The boolean- Returns:
- The constructed Optional
-
of
Constructs a newOptional<Boolean>
from the givenBoolean
.- Parameters:
bool
- The boolean- Returns:
- The constructed Optional, or
Optional.empty()
-
of
Coerces the givenOptional<Boolean>
into one of the three stored states.- Parameters:
bool
- The boolean- Returns:
- The constructed Optional, or
Optional.empty()
-