public class MutableInteger
extends java.lang.Number
implements java.io.Serializable
The built-in Java Integer class does not allow changing the value of the wrapped integer value once the Integer object is created. MutableInteger provides most of the same methods as Integer but adds extra methods to allow changing the value of the stored integer. This is useful when wrapping integers for storage in collection types since it is much more efficient to update the value of an existing MutableInteger than to create a new Integer every time the value changes.
| Modifier and Type | Field and Description | 
|---|---|
| protected int | mutableIntegerThe integer wrapped here. | 
| Constructor and Description | 
|---|
| MutableInteger(int i)Create MutableInteger object from an int value. | 
| MutableInteger(java.lang.String s)Create MutableInteger 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(int i,
         int 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.Integer | toInteger() | 
| java.lang.String | toString() | 
public MutableInteger(int i)
i - The integer being wrapped.public MutableInteger(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(int i,
            int 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.Integer toInteger()