Package org.spongepowered.api.util
Class OptBool
- java.lang.Object
-
- org.spongepowered.api.util.OptBool
-
public final class OptBool extends Object
Utility for working withOptional<Boolean>s.This also saves memory by holding three static instances of
Optional<Boolean>, which represents the possible states it can have.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<Boolean>of(boolean bool)Constructs a newOptional<Boolean>from the given boolean.static Optional<Boolean>of(@Nullable Boolean bool)Constructs a newOptional<Boolean>from the givenBoolean.static Optional<Boolean>of(Optional<Boolean> bool)Coerces the givenOptional<Boolean>into one of the three stored states.
-
-
-
Method Detail
-
of
public static Optional<Boolean> of(boolean bool)
Constructs a newOptional<Boolean>from the given boolean.- Parameters:
bool- The boolean- Returns:
- The constructed Optional
-
of
public static Optional<Boolean> of(@Nullable Boolean bool)
Constructs a newOptional<Boolean>from the givenBoolean.- Parameters:
bool- The boolean- Returns:
- The constructed Optional, or
Optional.empty()
-
of
public static Optional<Boolean> of(Optional<Boolean> bool)
Coerces the givenOptional<Boolean>into one of the three stored states.- Parameters:
bool- The boolean- Returns:
- The constructed Optional, or
Optional.empty()
-
-