com.darwinsys.util
Class MutableInteger

java.lang.Object
  |
  +--com.darwinsys.util.MutableInteger

public class MutableInteger
extends java.lang.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 :-))


Constructor Summary
MutableInteger()
           
MutableInteger(int i)
           
 
Method Summary
 void decr()
           
 int getValue()
           
 void incr()
           
static int parseInt(java.lang.String str)
           
 void setValue(int i)
           
 java.lang.String toString()
           
static java.lang.String toString(int val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableInteger

public MutableInteger()

MutableInteger

public MutableInteger(int i)
Method Detail

incr

public void incr()

decr

public void decr()

setValue

public void setValue(int i)

getValue

public int getValue()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public static java.lang.String toString(int val)

parseInt

public static int parseInt(java.lang.String str)