public class MutableBoolean extends Object implements Mutable<Boolean>, Serializable, Comparable<MutableBoolean>
boolean wrapper.
This class was created before the introduction of AtomicBoolean.
Note that as MutableBoolean does not extend Boolean, it is not treated by String.format(String, Object...) as a Boolean parameter.
Boolean,
AtomicBoolean,
Serialized Form| Constructor and Description |
|---|
MutableBoolean()
Constructs a new MutableBoolean with the default value of false.
|
MutableBoolean(boolean value)
Constructs a new MutableBoolean with the specified value.
|
MutableBoolean(Boolean value)
Constructs a new MutableBoolean with the specified value.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
booleanValue()
Returns the value of this MutableBoolean as a boolean.
|
int |
compareTo(MutableBoolean other)
Compares this mutable to another in ascending order.
|
boolean |
equals(Object obj)
Compares this object to the specified object.
|
Boolean |
getValue()
Deprecated.
Use
Mutable.get(). |
int |
hashCode()
Returns a suitable hash code for this mutable.
|
boolean |
isFalse()
Checks if the current value is
false. |
boolean |
isTrue()
Checks if the current value is
true. |
void |
setFalse()
Sets the value to false.
|
void |
setTrue()
Sets the value to true.
|
void |
setValue(boolean value)
Sets the value.
|
void |
setValue(Boolean value)
Sets the value from any Boolean instance.
|
Boolean |
toBoolean()
Gets this mutable as an instance of Boolean.
|
String |
toString()
Returns the String value of this mutable.
|
public MutableBoolean()
public MutableBoolean(boolean value)
value - the initial value to storepublic MutableBoolean(Boolean value)
value - the initial value to store, not nullNullPointerException - if the object is nullpublic boolean booleanValue()
public int compareTo(MutableBoolean other)
compareTo in interface Comparable<MutableBoolean>other - the other mutable to compare to, not nullpublic boolean equals(Object obj)
true if and only if the argument is
not null and is an MutableBoolean object that contains the same
boolean value as this object.@Deprecated public Boolean getValue()
Mutable.get().public int hashCode()
public boolean isFalse()
false.true if the current value is falsepublic boolean isTrue()
true.true if the current value is truepublic void setFalse()
public void setTrue()
public void setValue(boolean value)
value - the value to setpublic void setValue(Boolean value)
setValue in interface Mutable<Boolean>value - the value to set, not nullNullPointerException - if the object is nullpublic Boolean toBoolean()
Copyright © 2001–2025 The Apache Software Foundation. All rights reserved.