FileDocCategorySizeDatePackage
MutableInteger.javaAPI DocExample1009Mon May 24 13:48:38 BST 2004com.darwinsys.lang

MutableInteger

public 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 :-))
version
$Id: MutableInteger.java,v 1.6 2004/05/24 17:48:38 ian Exp $

Fields Summary
private int
value
Constructors Summary
public MutableInteger(int i)


	   
		value = i;
	
public MutableInteger()

		this(0);
	
Methods Summary
public intdecr()

		value--;
		return value;
	
public intgetValue()

		return value;
	
public intincr()

		value++;
		return value;
	
public intincr(int amt)

		value += amt;
		return value;
	
public static intparseInt(java.lang.String str)

		return Integer.parseInt(str);
	
public intsetValue(int i)

		value = i;
		return value;
	
public java.lang.StringtoString()

		return Integer.toString(value);
	
public static java.lang.StringtoString(int val)

		return Integer.toString(val);