Package smile.util
Class MutableInt
java.lang.Object
smile.util.MutableInt
A mutable int wrapper. It is efficient as counter in HashMap.
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
value
public int valueThe integer value.
-
-
Constructor Details
-
MutableInt
public MutableInt()Constructor. The initial value is 1 since we're counting. -
MutableInt
public MutableInt(int value) Constructor.- Parameters:
value
- the initial value.
-
-
Method Details
-
increment
public int increment()Increment by one.- Returns:
- the update value.
-
increment
public int increment(int x) Increment.- Parameters:
x
- the operand.- Returns:
- the update value.
-
decrement
public int decrement()Decrement by one.- Returns:
- the update value.
-
decrement
public int decrement(int x) Decrement.- Parameters:
x
- the operand.- Returns:
- the update value.
-