Boolean

Fields

public static final Boolean FALSE
Since:  API Level 1

The Boolean object that represents the primitive value false.

public static final Boolean TRUE
Since:  API Level 1

The Boolean object that represents the primitive value true.

public static final Class<BooleanTYPE
Since:  API Level 1

The Class object that represents the primitive type boolean.

Public Constructors

public Boolean (String string)
Since:  API Level 1

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
stringthe string representing a boolean value.
public Boolean (boolean value)
Since:  API Level 1

Constructs a new Boolean with the specified primitive boolean value.

Parameters
valuethe primitive boolean value, true or false.

Public Methods

public boolean booleanValue ()
Since:  API Level 1

Gets the primitive value of this boolean, either true or false.

Returns
  • this object's primitive value, true or false.
public int compareTo (Boolean that)
Since:  API Level 1

Compares this object to the specified boolean object to determine their relative order.

Parameters
thatthe 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 is true and the value of that is false; a negative value if the value if this boolean is false and the value of that is true.
See Also
public boolean equals (Object o)
Since:  API Level 1

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
othe object to compare this boolean with.
Returns
  • true if the specified object is equal to this Booleanfalse otherwise.
public static boolean getBoolean (String string)
Since:  API Level 1

Returns the boolean value of the system property identified by string.

Parameters
stringthe name of the requested system property.
Returns
  • true if the system property named by string exists and it is equal to "true" using case insensitive comparison, false otherwise.
public int hashCode ()
Since:  API Level 1

Returns an integer hash code for this boolean.

Returns
  • this boolean's hash code, which is 1231 for true values and 1237 for false values.
public static boolean parseBoolean (String s)
Since:  API Level 1

Parses the specified string as a boolean.

Parameters
sthe string representation of a boolean value.
Returns
  • true if s is not null and is equal to "true" using case insensitive comparison, false otherwise.
public static String toString (boolean value)
Since:  API Level 1

Converts the specified boolean to its string representation.

Parameters
valuethe boolean to convert.
Returns
  • "true" if value is true, "false" otherwise.
public String toString ()
Since:  API Level 1

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)
Since:  API Level 1

Parses the specified string as a boolean value.

Parameters
stringthe string representation of a boolean value.
Returns
  • Boolean.TRUE if string is equal to "true" using case insensitive comparison, Boolean.FALSE otherwise.
public static Boolean valueOf (boolean b)
Since:  API Level 1

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
bthe boolean to convert to a Boolean.
Returns
  • Boolean.TRUE if b is equal to trueBoolean.FALSE otherwise.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值