public class MutableBoolean extends Object implements Mutable<Boolean>, Serializable, Comparable<MutableBoolean>
boolean
wrapper.
Note that as MutableBoolean does not extend Boolean, it is not treated by String.format as a Boolean parameter.
Boolean
,
Serialized FormConstructor 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()
Gets the value as a Boolean instance.
|
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 void setValue(boolean value)
value
- the value to setpublic void setFalse()
public void setTrue()
public void setValue(Boolean value)
setValue
in interface Mutable<Boolean>
value
- the value to set, not nullNullPointerException
- if the object is nullpublic boolean isTrue()
true
.true
if the current value is true
public boolean isFalse()
false
.true
if the current value is false
public boolean booleanValue()
public Boolean toBoolean()
public 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.public int hashCode()
public int compareTo(MutableBoolean other)
compareTo
in interface Comparable<MutableBoolean>
other
- the other mutable to compare to, not nullCopyright © 2001–2018 The Apache Software Foundation. All rights reserved.