public final class MutableByte extends Number implements 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.
MutableByte is NOT thread-safe.
Byte,
Serialized Form| Modifier 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(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)
Gets the and set.
|
byte |
getValue()
Deprecated.
replace by
value(). |
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)
Sets the and get.
|
<E extends Exception> |
setIf(byte newValue,
Throwables.ByteBiPredicate<E> predicate)
Deprecated.
|
<E extends Exception> |
setIf(byte newValue,
Throwables.BytePredicate<E> predicate)
Set with the specified new value and returns
true if predicate returns true. |
void |
setValue(byte value)
Sets the value.
|
void |
subtract(byte operand)
Subtracts a value from the value of this instance.
|
String |
toString()
Returns the String value of this mutable.
|
byte |
value() |
shortValuepublic static MutableByte of(byte value)
value - public byte value()
@Deprecated public byte getValue()
value().public void setValue(byte value)
public byte getAndSet(byte value)
value - public byte setAndGet(byte value)
value - public <E extends Exception> boolean setIf(byte newValue, Throwables.BytePredicate<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(byte newValue, Throwables.ByteBiPredicate<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(byte operand)
public void subtract(byte operand)
public 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()
public int intValue()
public long longValue()
public float floatValue()
floatValue in class Numberpublic double doubleValue()
doubleValue in class Numberpublic int compareTo(MutableByte other)
compareTo in interface Comparable<MutableByte>public boolean equals(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.
obj the object to compare with, null returns falsepublic int hashCode()
Copyright © 2021. All rights reserved.