int wrapper.
This class was created before the introduction of the the java. package and the AtomicInteger class.
Note that as MutableInt does not extend Integer, it is not treated by String#format(String, Object. as an Integer parameter.
Integer, AtomicInteger
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Required for serialization support.
|
| private int | value
The mutable value. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | MutableInt(final int
the initial value to store. value)Constructs a new MutableInt with the specified value. |
| public | MutableInt(final Number
the initial value to store, not null. value)Constructs a new MutableInt with the specified value. |
| public | MutableInt(final String
the string to parse, not null. value)Constructs a new MutableInt parsing the given string. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public int | Returns: the value associated with this instance after adding the operand.the quantity to add, not null. operand)Increments this instance's value by |
| public int | |
| public int | Returns: negative if this is less, zero if equal, positive if greater.the other mutable to compare to, not null. other)Implements java. Compares this mutable to another in ascending order. |
| public void | |
| public int | Returns: the value associated with the instance after it is decremented.Decrements this instance's value by 1; this method returns the value associated with the instance immediately after the decrement operation. |
| public double | Returns: the numeric value represented by this object after conversion to type double.Implements abstract java. Returns the value of this MutableInt as a double. |
| public boolean | Returns: true if the objects are the same; false otherwise.the object to compare with, null returns false. obj)Overrides java. Compares this object to the specified object. |
| public float | Returns: the numeric value represented by this object after conversion to type float.Implements abstract java. Returns the value of this MutableInt as a float. |
| public int | Returns: the value associated with this instance immediately before the operand was added.the quantity to add, not null. operand)Increments this instance's value by |
| public int | |
| public int | Returns: the value associated with the instance before it was decremented.Decrements this instance's value by 1; this method returns the value associated with the instance immediately prior to the decrement operation. |
| public int | Returns: the value associated with the instance before it was incremented.Increments this instance's value by 1; this method returns the value associated with the instance immediately prior to the increment operation. |
| public Integer | Returns: the value as a Integer, never null.Implements org.
Deprecated
Use
get().
Gets the value as a Integer instance. |
| public int | Returns: a suitable hash code.Overrides java. Returns a suitable hash code for this mutable. |
| public void | |
| public int | Returns: the value associated with the instance after it is incremented.Increments this instance's value by 1; this method returns the value associated with the instance immediately after the increment operation. |
| public int | Returns: the numeric value represented by this object after conversion to type int.Implements abstract java. Returns the value of this MutableInt as an int. |
| public long | Returns: the numeric value represented by this object after conversion to type long.Implements abstract java. Returns the value of this MutableInt as a long. |
| public void | setValue(final int
the value to set. value)Implements org. Sets the value. |
| public void | setValue(final Number
the value to set, not null. value)Implements org. Sets the value from any Number instance. |
| public void | subtract(final int
the value to subtract, not null. operand)Subtracts a value from the value of this instance. |
| public void | |
| public Integer | Returns: an Integer instance containing the value from this mutable, never null.Gets this mutable as an instance of Integer. |
| public String | Returns: the mutable value as a string.Overrides java. Returns the String value of this mutable. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Required for serialization support.
| |
| value | back to summary |
|---|---|
| private int value The mutable value. | |
| MutableInt | back to summary |
|---|---|
| public MutableInt() Constructs a new MutableInt with the default value of zero. | |
| MutableInt | back to summary |
|---|---|
| public MutableInt(final int value) Constructs a new MutableInt with the specified value.
| |
| MutableInt | back to summary |
|---|---|
| public MutableInt(final Number value) Constructs a new MutableInt with the specified value.
| |
| MutableInt | back to summary |
|---|---|
| public MutableInt(final String value) Constructs a new MutableInt parsing the given string.
| |
| add | back to summary |
|---|---|
| public void add(final int operand) Adds a value to the value of this instance.
| |
| add | back to summary |
|---|---|
| public void add(final Number operand) Adds a value to the value of this instance.
| |
| addAndGet | back to summary |
|---|---|
| public int addAndGet(final int operand) Increments this instance's value by
| |
| addAndGet | back to summary |
|---|---|
| public int addAndGet(final Number operand) Increments this instance's value by
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(final MutableInt other) Implements java. Compares this mutable to another in ascending order.
| |
| decrement | back to summary |
|---|---|
| public void decrement() Decrements the value.
| |
| decrementAndGet | back to summary |
|---|---|
| public int decrementAndGet() Decrements this instance's value by 1; this method returns the value associated with the instance immediately after the decrement operation. This method is not thread safe.
| |
| doubleValue | back to summary |
|---|---|
| public double doubleValue() Implements abstract java. Returns the value of this MutableInt as a double.
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Compares this object to the specified object. The result is | |
| floatValue | back to summary |
|---|---|
| public float floatValue() Implements abstract java. Returns the value of this MutableInt as a float.
| |
| getAndAdd | back to summary |
|---|---|
| public int getAndAdd(final int operand) Increments this instance's value by
| |
| getAndAdd | back to summary |
|---|---|
| public int getAndAdd(final Number operand) Increments this instance's value by
| |
| getAndDecrement | back to summary |
|---|---|
| public int getAndDecrement() Decrements this instance's value by 1; this method returns the value associated with the instance immediately prior to the decrement operation. This method is not thread safe.
| |
| getAndIncrement | back to summary |
|---|---|
| public int getAndIncrement() Increments this instance's value by 1; this method returns the value associated with the instance immediately prior to the increment operation. This method is not thread safe.
| |
| getValue | back to summary |
|---|---|
| public Integer getValue() Implements org. Deprecated Use Gets the value as a Integer instance.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a suitable hash code for this mutable.
| |
| increment | back to summary |
|---|---|
| public void increment() Increments the value.
| |
| incrementAndGet | back to summary |
|---|---|
| public int incrementAndGet() Increments this instance's value by 1; this method returns the value associated with the instance immediately after the increment operation. This method is not thread safe.
| |
| intValue | back to summary |
|---|---|
| public int intValue() Implements abstract java. Returns the value of this MutableInt as an int.
| |
| longValue | back to summary |
|---|---|
| public long longValue() Implements abstract java. Returns the value of this MutableInt as a long.
| |
| setValue | back to summary |
|---|---|
| public void setValue(final int value) Implements org. Sets the value.
| |
| setValue | back to summary |
|---|---|
| public void setValue(final Number value) Implements org. Sets the value from any Number instance.
| |
| subtract | back to summary |
|---|---|
| public void subtract(final int operand) Subtracts a value from the value of this instance.
| |
| subtract | back to summary |
|---|---|
| public void subtract(final Number operand) Subtracts a value from the value of this instance.
| |
| toInteger | back to summary |
|---|---|
| public Integer toInteger() Gets this mutable as an instance of Integer.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the String value of this mutable. | |