com.darwinsys.lang
Class MutableInteger

java.lang.Object
  extended by com.darwinsys.lang.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 :-))

Version:
$Id: MutableInteger.java,v 1.6 2004/05/24 17:48:38 ian Exp $

Constructor Summary
MutableInteger()
           
MutableInteger(int i)
           
 
Method Summary
 int decr()
           
 int getValue()
           
 int incr()
           
 int incr(int amt)
           
static int parseInt(java.lang.String str)
           
 int 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(int i)

MutableInteger

public MutableInteger()
Method Detail

incr

public int incr()

incr

public int incr(int amt)

decr

public int decr()

setValue

public int 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)


Copyright © 1996-2004 Ian F. Darwin. See license.html for usage license.