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 |
mutableLong
The 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.NumberFormatException
public 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.Object
public int hashCode()
hashCode
in class java.lang.Object
public byte byteValue()
byteValue
in class java.lang.Number
public short shortValue()
shortValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public double doubleValue()
doubleValue
in class java.lang.Number
public java.lang.String toString()
toString
in class java.lang.Object
public 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()