Package dev.brachtendorf.mutable
Class MutableFloat
- java.lang.Object
-
- java.lang.Number
-
- dev.brachtendorf.mutable.MutableFloat
-
- All Implemented Interfaces:
Mutable<Float>,Serializable,Comparable<MutableFloat>
public class MutableFloat extends Number implements Mutable<Float>, Comparable<MutableFloat>
Mutable class wrapper for float values. Mutable classes are useful in lambda expressions or anonymous classes which want to alter the content of a variable but are limited to final or effective final variables. Be aware that the hashcode changes if the value is updated resulting in the object not being retrievable in hash collections.- Since:
- 1.0.0 com.github.kilianB
- Author:
- Kilian
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MutableFloat()Create a mutable Float with an initial value of 0MutableFloat(float initialValue)Create a mutable Float.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(MutableFloat o)doubledoubleValue()booleanequals(Object obj)floatfloatValue()FloatgetValue()Get an object encapsulating the current valueinthashCode()intintValue()longlongValue()voidsetValue(float newValue)Set the internal field to the new valuevoidsetValue(Float newValue)Set the internal field to the new value-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Method Detail
-
compareTo
public int compareTo(MutableFloat o)
- Specified by:
compareToin interfaceComparable<MutableFloat>
-
getValue
public Float getValue()
Description copied from interface:MutableGet an object encapsulating the current value
-
setValue
public void setValue(Float newValue)
Description copied from interface:MutableSet the internal field to the new value
-
setValue
public void setValue(float newValue)
Set the internal field to the new value- Parameters:
newValue- the new value- Since:
- 1.2.0 com.github.kilianB
-
floatValue
public float floatValue()
- Specified by:
floatValuein classNumber- Returns:
- the current value as float primitive
-
doubleValue
public double doubleValue()
- Specified by:
doubleValuein classNumber
-
-