MutableIntegerpublic class MutableInteger extends Object A MutableInteger is like an Integer but mutable, to avoid the
excess object creation involved in
c = new Integer(c.getInt()+1)
which can get expensive if done a lot.
Not subclassed from Integer, since Integer is final (for performance :-)) |
Fields Summary |
---|
private int | value |
Constructors Summary |
---|
public MutableInteger()
| public MutableInteger(int i)
value = i;
|
Methods Summary |
---|
public void | decr()
value--;
| public int | getValue()
return value;
| public void | incr()
value++;
| public void | incr(int amt)
value += amt;
| public static int | parseInt(java.lang.String str)
return Integer.parseInt(str);
| public void | setValue(int i)
value = i;
| public java.lang.String | toString()
return Integer.toString(value);
| public static java.lang.String | toString(int val)
return Integer.toString(val);
|
|