double wrapper.
This class was created before the introduction of the the java. package and the DoubleAccumulator class.
Note that as MutableDouble does not extend Double, it is not treated by String.format as a Double parameter.
Double, DoubleAccumulator, DoubleAdder
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Required for serialization support.
|
| private double | value
The mutable value. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | MutableDouble(final double
the initial value to store. value)Constructs a new MutableDouble with the specified value. |
| public | MutableDouble(final Number
the initial value to store, not null. value)Constructs a new MutableDouble with the specified value. |
| public | MutableDouble(final String
the string to parse, not null. value)Constructs a new MutableDouble parsing the given string. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public double | 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 double | |
| 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 double | 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 MutableDouble 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 against 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 MutableDouble as a float. |
| public double | 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 double | |
| public double | 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 double | 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 Double | Returns: the value as a Double, never null.Implements org.
Deprecated
Use
get().
Gets the value as a Double instance. |
| public int | Returns: a suitable hash code.Overrides java. Returns a suitable hash code for this mutable. |
| public void | |
| public double | 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 MutableDouble as an int. |
| public boolean | |
| public boolean | |
| public long | Returns: the numeric value represented by this object after conversion to type long.Implements abstract java. Returns the value of this MutableDouble as a long. |
| public void | setValue(final double
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 double
the value to subtract, not null. operand)Subtracts a value from the value of this instance. |
| public void | |
| public Double | Returns: a Double instance containing the value from this mutable, never null.Gets this mutable as an instance of Double. |
| 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 double value The mutable value. | |
| MutableDouble | back to summary |
|---|---|
| public MutableDouble() Constructs a new MutableDouble with the default value of zero. | |
| MutableDouble | back to summary |
|---|---|
| public MutableDouble(final double value) Constructs a new MutableDouble with the specified value.
| |
| MutableDouble | back to summary |
|---|---|
| public MutableDouble(final Number value) Constructs a new MutableDouble with the specified value.
| |
| MutableDouble | back to summary |
|---|---|
| public MutableDouble(final String value) Constructs a new MutableDouble parsing the given string.
| |
| add | back to summary |
|---|---|
| public void add(final double 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 double addAndGet(final double operand) Increments this instance's value by
| |
| addAndGet | back to summary |
|---|---|
| public double addAndGet(final Number operand) Increments this instance's value by
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(final MutableDouble 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 double 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 MutableDouble as a double.
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Compares this object against the specified object. The result is
Note that in most cases, for two instances of class d1.doubleValue() == d2.doubleValue()
also has the value
| |
| floatValue | back to summary |
|---|---|
| public float floatValue() Implements abstract java. Returns the value of this MutableDouble as a float.
| |
| getAndAdd | back to summary |
|---|---|
| public double getAndAdd(final double operand) Increments this instance's value by
| |
| getAndAdd | back to summary |
|---|---|
| public double getAndAdd(final Number operand) Increments this instance's value by
| |
| getAndDecrement | back to summary |
|---|---|
| public double 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 double 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 Double getValue() Implements org. Deprecated Use Gets the value as a Double 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 double 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 MutableDouble as an int.
| |
| isInfinite | back to summary |
|---|---|
| public boolean isInfinite() Checks whether the double value is infinite.
| |
| isNaN | back to summary |
|---|---|
| public boolean isNaN() Checks whether the double value is the special NaN value.
| |
| longValue | back to summary |
|---|---|
| public long longValue() Implements abstract java. Returns the value of this MutableDouble as a long.
| |
| setValue | back to summary |
|---|---|
| public void setValue(final double 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 double 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.
| |
| toDouble | back to summary |
|---|---|
| public Double toDouble() Gets this mutable as an instance of Double.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the String value of this mutable. | |