public final class MutableShort extends Number implements Comparable<MutableShort>, Mutable
Note: it's copied from Apache Commons Lang developed at The Apache Software Foundation (http://www.apache.org/), or under the Apache License 2.0. The methods copied from other products/frameworks may be modified in this class.
A mutableshort wrapper.
Note that as MutableShort does not extend Short, it is not treated by String.format as a Short parameter.
MutableShort is NOT thread-safe.
Short,
Serialized Form| Modifier and Type | Method and Description |
|---|---|
void |
add(short operand)
Adds a value to the value of this instance.
|
short |
addAndGet(short delta)
Adds the given value to the current value.
|
int |
compareTo(MutableShort other)
Compares this mutable to another in ascending order.
|
void |
decrement()
Decrements the value.
|
short |
decrementAndGet()
Decrements by one the current value.
|
double |
doubleValue()
Returns the value of this MutableShort as a double.
|
boolean |
equals(Object obj)
Compares this object to the specified object.
|
float |
floatValue()
Returns the value of this MutableShort as a float.
|
short |
getAndAdd(short delta)
Adds the given value to the current value.
|
short |
getAndDecrement()
Decrements by one the current value.
|
short |
getAndIncrement()
Increments by one the current value.
|
short |
getAndSet(short value)
Gets the and set.
|
short |
getValue()
Deprecated.
replace by
value(). |
int |
hashCode()
Returns a suitable hash code for this mutable.
|
void |
increment()
Increments the value.
|
short |
incrementAndGet()
Increments by one the current value.
|
int |
intValue()
Returns the value of this MutableShort as an int.
|
long |
longValue()
Returns the value of this MutableShort as a long.
|
static MutableShort |
of(short value) |
short |
setAndGet(short value)
Sets the and get.
|
<E extends Exception> |
setIf(short newValue,
Throwables.ShortBiPredicate<E> predicate)
Deprecated.
|
<E extends Exception> |
setIf(short newValue,
Throwables.ShortPredicate<E> predicate)
Set with the specified new value and returns
true if predicate returns true. |
void |
setValue(short value)
Sets the value.
|
short |
shortValue()
Returns the value of this MutableShort as a short.
|
void |
subtract(short operand)
Subtracts a value from the value of this instance.
|
String |
toString()
Returns the String value of this mutable.
|
short |
value() |
public static MutableShort of(short value)
value - public short value()
@Deprecated public short getValue()
value().public void setValue(short value)
public short getAndSet(short value)
value - public short setAndGet(short value)
value - public <E extends Exception> boolean setIf(short newValue, Throwables.ShortPredicate<E> predicate) throws E extends Exception
true if predicate returns true.
Otherwise just return false without setting the value to new value.E - newValue - predicate - - test the current value.E - the eE extends Exception@Deprecated public <E extends Exception> boolean setIf(short newValue, Throwables.ShortBiPredicate<E> predicate) throws E extends Exception
true if predicate returns true.
Otherwise just return false without setting the value to new value.E - newValue - predicate - the first parameter is the current value, the second parameter is the new value.E - the eE extends Exceptionpublic void increment()
public void decrement()
public void add(short operand)
public void subtract(short operand)
public final short getAndIncrement()
public final short getAndDecrement()
public final short incrementAndGet()
public final short decrementAndGet()
public final short getAndAdd(short delta)
delta - the value to addpublic final short addAndGet(short delta)
delta - the value to addpublic short shortValue()
shortValue in class Numberpublic int intValue()
public long longValue()
public float floatValue()
floatValue in class Numberpublic double doubleValue()
doubleValue in class Numberpublic int compareTo(MutableShort other)
compareTo in interface Comparable<MutableShort>public boolean equals(Object obj)
true if and only if the argument
is not null and is a MutableShort object that contains the same short
value as this object.
obj the object to compare with, null returns falsepublic int hashCode()
Copyright © 2021. All rights reserved.