public final class MutableByte extends java.lang.Number implements java.lang.Comparable<MutableByte>, 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 mutablebyte
wrapper.
Note that as MutableByte does not extend Byte, it is not treated by String.format as a Byte parameter.
Byte
,
Serialized FormModifier and Type | Method and Description |
---|---|
void |
add(byte operand)
Adds a value to the value of this instance.
|
byte |
addAndGet(byte delta)
Adds the given value to the current value.
|
byte |
byteValue()
Returns the value of this MutableByte as a byte.
|
int |
compareTo(MutableByte other)
Compares this mutable to another in ascending order.
|
void |
decrement()
Decrements the value.
|
byte |
decrementAndGet()
Decrements by one the current value.
|
double |
doubleValue()
Returns the value of this MutableByte as a double.
|
boolean |
equals(java.lang.Object obj)
Compares this object to the specified object.
|
float |
floatValue()
Returns the value of this MutableByte as a float.
|
byte |
getAndAdd(byte delta)
Adds the given value to the current value.
|
byte |
getAndDecrement()
Decrements by one the current value.
|
byte |
getAndIncrement()
Increments by one the current value.
|
byte |
getAndSet(byte value) |
byte |
getValue()
Gets the value as a Byte instance.
|
int |
hashCode()
Returns a suitable hash code for this mutable.
|
void |
increment()
Increments the value.
|
byte |
incrementAndGet()
Increments by one the current value.
|
int |
intValue()
Returns the value of this MutableByte as an int.
|
long |
longValue()
Returns the value of this MutableByte as a long.
|
static MutableByte |
of(byte value) |
byte |
setAndGet(byte value) |
<E extends java.lang.Exception> |
setIf(byte newValue,
Try.ByteBiPredicate<E> predicate)
Set with the specified new value and returns
true if predicate returns true. |
<E extends java.lang.Exception> |
setIf(byte newValue,
Try.BytePredicate<E> predicate)
Set with the specified new value and returns
true if predicate returns true. |
MutableByte |
setValue(byte value)
Sets the value.
|
void |
subtract(byte operand)
Subtracts a value from the value of this instance.
|
java.lang.String |
toString()
Returns the String value of this mutable.
|
byte |
value() |
public static MutableByte of(byte value)
public byte value()
public byte getValue()
public MutableByte setValue(byte value)
value
- the value to setpublic byte getAndSet(byte value)
public byte setAndGet(byte value)
public <E extends java.lang.Exception> boolean setIf(byte newValue, Try.BytePredicate<E> predicate) throws E extends java.lang.Exception
true
if predicate
returns true.
Otherwise just return false
without setting the value to new value.newValue
- predicate
- - test the current value.E extends java.lang.Exception
public <E extends java.lang.Exception> boolean setIf(byte newValue, Try.ByteBiPredicate<E> predicate) throws E extends java.lang.Exception
true
if predicate
returns true.
Otherwise just return false
without setting the value to new value.newValue
- predicate
- the first parameter is the current value, the second parameter is the new value.E extends java.lang.Exception
public void increment()
public void decrement()
public void add(byte operand)
operand
- the value to add, not nullpublic void subtract(byte operand)
operand
- the value to subtract, not nullpublic final byte getAndIncrement()
public final byte getAndDecrement()
public final byte incrementAndGet()
public final byte decrementAndGet()
public final byte getAndAdd(byte delta)
delta
- the value to addpublic final byte addAndGet(byte delta)
delta
- the value to addpublic byte byteValue()
byteValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public double doubleValue()
doubleValue
in class java.lang.Number
public int compareTo(MutableByte other)
compareTo
in interface java.lang.Comparable<MutableByte>
other
- the other mutable to compare to, not nullpublic boolean equals(java.lang.Object obj)
true
if and only if the argument is
not null
and is a MutableByte
object that contains the same byte
value
as this object.equals
in class java.lang.Object
obj
- the object to compare with, null returns falsetrue
if the objects are the same; false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object