Skip to main content

AtomicFloat

class AtomicFloat

An AtomicFloat is a float value that need to be updated atomically, see java.util.concurrent.atomic package to view atomic specifications.


public class AtomicFloat extends Number

— Constructors (2) —

ConstructorDescription
AtomicFloat()Creates a new AtomicFloat with the default value set to 0.0f.
AtomicFloat(float initialValue)Creates a new AtomicFloat with the default value to be "value" argument.

— Methods (10) —

NameDescription
float get()Return the current float value.
void set(float newValue)Set the current value to be "value" argument.
boolean compareAndSet(float expect, float update)If the current value is equal to "expected" argument, the current value will be set to be "update" argument.
boolean weakCompareAndSet(float expect, float update)If the current value is equal to "expected" argument, the current value will be set to be "update" argument.
float getAndSet(float newValue)Return the current float value and set to be "value" argument.
float floatValue()Return the current float value.
double doubleValue()Return the current float value as double.
long longValue()Return the current float value as long.
int intValue()Return the current float value as int.
String toString()Returns a String with the current name of the Class.