long wrapper.
This class was created before the introduction of the the java. package and the AtomicLong class.
Note that as MutableLong does not extend Long, it is not treated by String#format(String, Object. as a Long parameter.
Long, AtomicLong
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Required for serialization support.
|
| private long | value
The mutable value. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | MutableLong(final long
the initial value to store. value)Constructs a new MutableLong with the specified value. |
| public | MutableLong(final Number
the initial value to store, not null. value)Constructs a new MutableLong with the specified value. |
| public | MutableLong(final String
the string to parse, not null. value)Constructs a new MutableLong parsing the given string. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public long | 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 long | |
| 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 long | 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 MutableLong 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 MutableLong as a float. |
| public long | 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 long | |
| public long | 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 long | 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 Long | Returns: the value as a Long, never null.Implements org.
Deprecated
Use
get().
Gets the value as a Long instance. |
| public int | Returns: a suitable hash code.Overrides java. Returns a suitable hash code for this mutable. |
| public void | |
| public long | 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 MutableLong 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 MutableLong as a long. |
| public void | setValue(final long
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 long
the value to subtract, not null. operand)Subtracts a value from the value of this instance. |
| public void | |
| public Long | Returns: a Long instance containing the value from this mutable, never null.Gets this mutable as an instance of Long. |
| 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 long value The mutable value. | |
| MutableLong | back to summary |
|---|---|
| public MutableLong() Constructs a new MutableLong with the default value of zero. | |
| MutableLong | back to summary |
|---|---|
| public MutableLong(final long value) Constructs a new MutableLong with the specified value.
| |
| MutableLong | back to summary |
|---|---|
| public MutableLong(final Number value) Constructs a new MutableLong with the specified value.
| |
| MutableLong | back to summary |
|---|---|
| public MutableLong(final String value) Constructs a new MutableLong parsing the given string.
| |
| add | back to summary |
|---|---|
| public void add(final long 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 long addAndGet(final long operand) Increments this instance's value by
| |
| addAndGet | back to summary |
|---|---|
| public long addAndGet(final Number operand) Increments this instance's value by
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(final MutableLong 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 long 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 MutableLong 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 MutableLong as a float.
| |
| getAndAdd | back to summary |
|---|---|
| public long getAndAdd(final long operand) Increments this instance's value by
| |
| getAndAdd | back to summary |
|---|---|
| public long getAndAdd(final Number operand) Increments this instance's value by
| |
| getAndDecrement | back to summary |
|---|---|
| public long 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 long 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 Long getValue() Implements org. Deprecated Use Gets the value as a Long 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 long 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 MutableLong as an int.
| |
| longValue | back to summary |
|---|---|
| public long longValue() Implements abstract java. Returns the value of this MutableLong as a long.
| |
| setValue | back to summary |
|---|---|
| public void setValue(final long 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 long 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.
| |
| toLong | back to summary |
|---|---|
| public Long toLong() Gets this mutable as an instance of Long.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the String value of this mutable. | |