public class MutableLong
extends java.lang.Number
implements java.io.Serializable
The built-in Java Long class does not allow changing the value of the wrapped Long value once the Long object is created. MutableLong provides most of the same methods as Long but adds extra methods to allow changing the value of the stored long. This is useful when wrapping longs for storage in collection types since it is much more efficient to update the value of an existing MutableLong than to create a new Long every time the value changes.
| Modifier and Type | Field and Description | 
|---|---|
| protected long | mutableLongThe long wrapped here. | 
| Constructor and Description | 
|---|
| MutableLong(long l)Create MutableLong object from an int value. | 
| MutableLong(java.lang.String s)Create MutableLong object from a string. | 
| Modifier and Type | Method and Description | 
|---|---|
| byte | byteValue() | 
| int | compareTo(java.lang.Number number)Compares this number to another number. | 
| int | compareTo(java.lang.Object obj)Compares this object to another object. | 
| protected int | doCompare(long i,
         long j) | 
| double | doubleValue() | 
| boolean | equals(java.lang.Object obj) | 
| float | floatValue() | 
| int | hashCode() | 
| int | intValue() | 
| long | longValue() | 
| void | setValue(byte aByte) | 
| void | setValue(double d) | 
| void | setValue(float f) | 
| void | setValue(int i) | 
| void | setValue(long l) | 
| void | setValue(short aWord) | 
| short | shortValue() | 
| java.lang.Long | toLong() | 
| java.lang.String | toString() | 
public MutableLong(long l)
l - The long being wrapped.public MutableLong(java.lang.String s)
            throws java.lang.NumberFormatException
s - String containing an integer value.java.lang.NumberFormatExceptionpublic int compareTo(java.lang.Object obj)
obj - The other object.public int compareTo(java.lang.Number number)
number - The other number.protected int doCompare(long i,
            long j)
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic byte byteValue()
byteValue in class java.lang.Numberpublic short shortValue()
shortValue in class java.lang.Numberpublic int intValue()
intValue in class java.lang.Numberpublic long longValue()
longValue in class java.lang.Numberpublic float floatValue()
floatValue in class java.lang.Numberpublic double doubleValue()
doubleValue in class java.lang.Numberpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setValue(byte aByte)
public void setValue(short aWord)
public void setValue(int i)
public void setValue(long l)
public void setValue(float f)
public void setValue(double d)
public java.lang.Long toLong()