Fields
public static final Boolean FALSE
The Boolean
object that represents the primitive value false
.
public static final Boolean TRUE
The Boolean
object that represents the primitive value true
.
public static final Class<Boolean> TYPE
The Class
object that represents the primitive type boolean
.
Public Constructors
public Boolean (String string)
Constructs a new Boolean
with its boolean value specified by string
. If string
is not null
and is equal to "true" using a non-case sensitive comparison, the result will be a Boolean representing the primitive value true
, otherwise it will be a Boolean representing the primitive value false
.
Parameters
string | the string representing a boolean value. |
---|
public Boolean (boolean value)
Constructs a new Boolean
with the specified primitive boolean value.
Parameters
value | the primitive boolean value, true or false . |
---|
Public Methods
public boolean booleanValue ()
Gets the primitive value of this boolean, either true
or false
.
Returns
- this object's primitive value,
true
orfalse
.
public int compareTo (Boolean that)
Compares this object to the specified boolean object to determine their relative order.
Parameters
that | the boolean object to compare this object to. |
---|
Returns
- 0 if the value of this boolean and the value of
that
are equal; a positive value if the value of this boolean istrue
and the value ofthat
isfalse
; a negative value if the value if this boolean isfalse
and the value ofthat
istrue
.
See Also
public boolean equals (Object o)
Compares this instance with the specified object and indicates if they are equal. In order to be equal, o
must be an instance of Boolean
and have the same boolean value as this object.
Parameters
o | the object to compare this boolean with. |
---|
Returns
-
true
if the specified object is equal to thisBoolean
;false
otherwise.
public static boolean getBoolean (String string)
Returns the boolean
value of the system property identified by string
.
Parameters
string | the name of the requested system property. |
---|
Returns
-
true
if the system property named bystring
exists and it is equal to "true" using case insensitive comparison,false
otherwise.
See Also
public int hashCode ()
Returns an integer hash code for this boolean.
Returns
- this boolean's hash code, which is
1231
fortrue
values and1237
forfalse
values.
public static boolean parseBoolean (String s)
Parses the specified string as a boolean
.
Parameters
s | the string representation of a boolean value. |
---|
Returns
-
true
ifs
is notnull
and is equal to"true"
using case insensitive comparison,false
otherwise.
public static String toString (boolean value)
Converts the specified boolean to its string representation.
Parameters
value | the boolean to convert. |
---|
Returns
- "true" if
value
istrue
, "false" otherwise.
public String toString ()
Returns a string containing a concise, human-readable description of this boolean.
Returns
- "true" if the value of this boolean is
true
, "false" otherwise.
public static Boolean valueOf (String string)
Parses the specified string as a boolean value.
Parameters
string | the string representation of a boolean value. |
---|
Returns
-
Boolean.TRUE
ifstring
is equal to "true" using case insensitive comparison,Boolean.FALSE
otherwise.
See Also
public static Boolean valueOf (boolean b)
Returns a Boolean
instance for the specified boolean value.
If it is not necessary to get a new Boolean
instance, it is recommended to use this method instead of the constructor, since it returns its static instances, which results in better performance.
Parameters
b | the boolean to convert to a Boolean . |
---|
Returns
-
Boolean.TRUE
ifb
is equal totrue
,Boolean.FALSE
otherwise.