MutableBoolean¶
- public class org.apache.commons.lang3.mutable.MutableBoolean implements Mutable<Boolean>, Serializable, Comparable<MutableBoolean>[source]¶
A mutable
booleanwrapper.This class was created before the introduction of the
java.util.concurrent.atomicpackage and theAtomicBooleanclass.Note that as MutableBoolean does not extend
Boolean, it is not treated byString#format(String, Object...)as a Boolean parameter.- See also:
- Since:
2.2
Constructors¶
Constructs a new MutableBoolean with the default value of false. |
|
Constructs a new MutableBoolean with the specified value. |
|
Constructs a new MutableBoolean with the specified value. |
Methods¶
Returns the value of this MutableBoolean as a boolean. |
|
Compares this mutable to another in ascending order. |
|
Compares this object to the specified object. |
|
Deprecated. Gets the value as a Boolean instance. |
|
Returns a suitable hash code for this mutable. |
|
Tests whether the current value is |
|
Tests whether the current value is |
|
Sets the value to false. |
|
Sets the value to true. |
|
Sets the value. |
|
Sets the value from any Boolean instance. |
|
Gets this mutable as an instance of Boolean. |
|
Returns the String value of this mutable. |
- public boolean booleanValue()[source]¶
Returns the value of this MutableBoolean as a boolean.
- Returns:
The boolean value represented by this object.
- @Override public int compareTo(MutableBoolean other)[source]¶
Compares this mutable to another in ascending order.
- Parameters:
other – The other mutable to compare to, not null
- Returns:
negative if this is less, zero if equal, positive if greater where false is less than true
- @Override public boolean equals(Object obj)[source]¶
Compares this object to the specified object. The result is
trueif and only if the argument is notnulland is anMutableBooleanobject that contains the samebooleanvalue as this object.- Parameters:
obj – The object to compare with, null returns false
- Returns:
trueif the objects are the same;falseotherwise.
- @Deprecated @Override public Boolean getValue()[source]¶
Deprecated: Use
#get().Gets the value as a Boolean instance.
- Returns:
The value as a Boolean, never null.
- @Override public int hashCode()[source]¶
Returns a suitable hash code for this mutable.
- Returns:
The hash code returned by
Boolean.TRUEorBoolean.FALSE
- public boolean isFalse()[source]¶
Tests whether the current value is
false.- Returns:
trueif the current value isfalse- Since:
2.5
- public boolean isTrue()[source]¶
Tests whether the current value is
true.- Returns:
trueif the current value istrue- Since:
2.5
- @Override public void setValue(Boolean value)[source]¶
Sets the value from any Boolean instance.
- Parameters:
value – The value to set, not null
- Throws:
java.lang.NullPointerException – Thrown if the object is null.