public enum TriState extends Enum<TriState>
TriState.TRUE
, TriState.FALSE
, and TriState.UNDEFINED
.
TriState
is preferable to using a Boolean
value with Boolean.TRUE
,
Boolean.FALSE
and null
, because Boolean
has a public constructor
which requires the use of Boolean.equals(Object)
to compare the values. The comparison
with Boolean.equals(Object)
is too slow.Enum.EnumDesc<E extends Enum<E>>
Enum Constant and Description |
---|
FALSE
The state is false.
|
TRUE
The state is true.
|
UNDEFINED
The state is undefined.
|
Modifier and Type | Method and Description |
---|---|
static TriState |
valueOf(boolean b)
Create a
TriState from a primitive boolean. |
static TriState |
valueOf(Boolean b)
Create a
TriState from a boxed Boolean explicitely checking for
null and returning TriState.UNDEFINED . |
static TriState |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static TriState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TriState TRUE
Boolean.TRUE
.public static final TriState FALSE
Boolean.FALSE
.public static final TriState UNDEFINED
null
.public static TriState[] values()
public static TriState valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static TriState valueOf(boolean b)
TriState
from a primitive boolean.public static TriState valueOf(Boolean b)
TriState
from a boxed Boolean
explicitely checking for
null
and returning TriState.UNDEFINED
.