public class MutableInteger
extends java.lang.Object
The provided implementation is not thread-safe, so it should be synchronized externally.
Constructor and Description |
---|
MutableInteger()
Constructs a mutable integer with
0 as its value. |
MutableInteger(int value)
Constructs a mutable integer with the specified value.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int value)
Adds the specified value to the value hold by this mutable integer.
|
void |
decrement()
Decrements the value hold by this mutable integer.
|
int |
getValue()
Returns the value hold by this mutable integer.
|
void |
increment()
Increments the value hold by this mutable integer.
|
void |
setValue(int value)
Sets the specified value as the value hold by this mutable integer.
|
void |
substract(int value)
Substracts the specified value to the value hold by this mutable integer.
|
public MutableInteger()
0
as its value.public MutableInteger(int value)
value
- the value for the mutable integer to create.public void setValue(int value)
value
- the value to set.public int getValue()
public void increment()
public void decrement()
public void add(int value)
value
- the value to add.public void substract(int value)
value
- the value to substract.