Android
java.lang
public final class

java.lang.Boolean

java.lang.Object
java.lang.Boolean Serializable Comparable<T>

Boolean is the wrapper for the primitive type boolean.

Summary

Constants

      Value  
Boolean  FALSE  The instance of the receiver which represents falsehood.     
Boolean  TRUE  The instance of the receiver which represents truth.     
Class<Boolean TYPE  The java.lang.Class that represents this class.     

Public Constructors

            Boolean(String string)
Constructs a new instance of this class given a string.
            Boolean(boolean value)
Constructs a new instance of this class given true or false.

Public Methods

          boolean  booleanValue()
Returns true if the receiver represents true and false if the receiver represents false.
          int  compareTo(Boolean that)

Compares this Boolean to another Boolean.

          boolean  equals(Object o)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
      static    boolean  getBoolean(String string)
Returns true if the system property described by the argument equal to "true" using case insensitive comparison, and false otherwise.
          int  hashCode()
Returns an integer hash code for the receiver.
      static    boolean  parseBoolean(String s)

Parses the string as a boolean.

      static    String  toString(boolean value)
Converts the specified boolean to its string representation.
          String  toString()
Returns a string containing a concise, human-readable description of the receiver.
      static    Boolean  valueOf(String string)
Returns a Boolean representing true if the argument is equal to "true" using case insensitive comparison, and a Boolean representing false otherwise.
      static    Boolean  valueOf(boolean b)
Returns Boolean.TRUE if the argument is equal to "true" using case insensitive comparison, and Boolean.FALSE representing false otherwise.
Methods inherited from class java.lang.Object
Methods inherited from interface java.lang.Comparable

Details

Constants

public static final Boolean FALSE

The instance of the receiver which represents falsehood.

public static final Boolean TRUE

The instance of the receiver which represents truth.

public static final Class<Boolean> TYPE

The java.lang.Class that represents this class.

Public Constructors

public Boolean(String string)

Constructs a new instance of this class given a string. If the string is equal to "true" using a non-case sensitive comparison, the result will be a Boolean representing true, otherwise it will be a Boolean representing false.

Parameters

string The name of the desired boolean.

public Boolean(boolean value)

Constructs a new instance of this class given true or false.

Parameters

value true or false.

Public Methods

public boolean booleanValue()

Returns true if the receiver represents true and false if the receiver represents false.

Returns

  • true or false.

public int compareTo(Boolean that)

Compares this Boolean to another Boolean. If this instance has the same value as the instance passed, then 0 is returned. If this instance is true and the instance passed is false, then a positive value is returned. If this instance is false and the instance passed is true, then a negative value is returned.

Parameters

that The instance to compare to.

Throws

NullPointerException if that is null.

See Also

public boolean equals(Object o)

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

In this case, the argument must also be a Boolean, and the receiver and argument must represent the same boolean value (i.e. both true or both false).

Parameters

o the object to compare with this object

Returns

  • true if the object is the same as this object false if it is different from this object

See Also

public static boolean getBoolean(String string)

Returns true if the system property described by the argument equal to "true" using case insensitive comparison, and false otherwise.

Parameters

string The name of the desired boolean.

Returns

  • The boolean value.

public int hashCode()

Returns an integer hash code for the receiver. Any two objects which answer true when passed to equals must answer the same value for this method.

Returns

  • the receiver's hash

See Also

public static boolean parseBoolean(String s)

Parses the string as a boolean. If the string is not null and is equal to "true", regardless case, then true is returned, otherwise false.

Parameters

s The string to parse.

Returns

  • A boolean value.

public static String toString(boolean value)

Converts the specified boolean to its string representation. When the boolean is true answer "true", otherwise answer "false".

Parameters

value the boolean

Returns

  • the boolean converted to a string

public String toString()

Returns a string containing a concise, human-readable description of the receiver.

Returns

  • a printable representation for the receiver.

public static Boolean valueOf(String string)

Returns a Boolean representing true if the argument is equal to "true" using case insensitive comparison, and a Boolean representing false otherwise.

Parameters

string The name of the desired boolean.

Returns

  • the boolean value.

public static Boolean valueOf(boolean b)

Returns Boolean.TRUE if the argument is equal to "true" using case insensitive comparison, and Boolean.FALSE representing false otherwise.

Parameters

b the boolean value.

Returns

  • Boolean.TRUE or Boolean.FALSE Global true/false objects.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56