public class MutableBoolean extends java.lang.Object implements Mutable<java.lang.Boolean>, java.io.Serializable, java.lang.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(java.lang.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(java.lang.Object obj)
Compares this object to the specified object.
|
java.lang.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(java.lang.Boolean value)
Sets the value from any Boolean instance.
|
java.lang.Boolean |
toBoolean()
Gets this mutable as an instance of Boolean.
|
java.lang.String |
toString()
Returns the String value of this mutable.
|
public MutableBoolean()
public MutableBoolean(boolean value)
value
- the initial value to storepublic MutableBoolean(java.lang.Boolean value)
value
- the initial value to store, not nulljava.lang.NullPointerException
- if the object is nullpublic java.lang.Boolean getValue()
public void setValue(boolean value)
value
- the value to setpublic void setFalse()
public void setTrue()
public void setValue(java.lang.Boolean value)
public 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 java.lang.Boolean toBoolean()
public boolean equals(java.lang.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.equals
in class java.lang.Object
obj
- the object to compare with, null returns falsetrue
if the objects are the same; false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
Boolean.TRUE
or Boolean.FALSE
public int compareTo(MutableBoolean other)
compareTo
in interface java.lang.Comparable<MutableBoolean>
other
- the other mutable to compare to, not nullpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved