public class MutableInteger
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
MutableInteger(int value)
Constructor creates a MutableInteger object with an initial value.
|
Modifier and Type | Method and Description |
---|---|
static <T> void |
addToBag(java.util.Map<T,MutableInteger> bag,
java.util.Map<T,MutableInteger> otherBag)
Adds to bag another bag.
|
static <T> void |
addToBag(java.util.Map<T,MutableInteger> bag,
T key)
Increments count to object in a bag.
|
static <T> void |
addToBag(java.util.Map<T,MutableInteger> bag,
T key,
int c)
Adds to count of object in a bag.
|
void |
addValue(int value)
Method to add the value of this MutableInteger.
|
static <T> int |
countInBag(java.util.Map<T,MutableInteger> bag,
T key)
Method to return the a value at a location in a collection.
|
void |
decrement()
Method to increment this MutableInteger by 1.
|
void |
increment()
Method to increment this MutableInteger by 1.
|
int |
intValue()
Method to return the value of this MutableInteger.
|
void |
setValue(int value)
Method to change the value of this MutableInteger.
|
java.lang.String |
toString()
Returns a printable version of this MutableInteger.
|
public MutableInteger(int value)
value
- the initial value.public void setValue(int value)
value
- the new value.public void addValue(int value)
value
- the value to add.public void increment()
public void decrement()
public int intValue()
public java.lang.String toString()
toString
in class java.lang.Object
public static <T> void addToBag(java.util.Map<T,MutableInteger> bag, T key)
bag
- Map implementing Bag.key
- object to add to bag.public static <T> void addToBag(java.util.Map<T,MutableInteger> bag, java.util.Map<T,MutableInteger> otherBag)
bag
- bag to update.otherBag
- bag used for update.public static <T> void addToBag(java.util.Map<T,MutableInteger> bag, T key, int c)
bag
- Map implementing Bag.key
- object in a bag.c
- count to add to bag.public static <T> int countInBag(java.util.Map<T,MutableInteger> bag, T key)
bag
- the collection (a Map).key
- a key to an entry in the collection.