Package org.nd4j.common.primitives
Class Atomic<T extends Serializable>
- java.lang.Object
-
- org.nd4j.common.primitives.Atomic<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
Serializable
public class Atomic<T extends Serializable> extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancas(T expected, T newValue)This method implements compare-and-swapbooleanequals(Object o)Tget()This method returns current valueinthashCode()voidset(T value)This method assigns new value
-
-
-
Constructor Detail
-
Atomic
public Atomic(T initialValue)
-
-
Method Detail
-
set
public void set(T value)
This method assigns new value- Parameters:
value-
-
get
public T get()
This method returns current value- Returns:
-
cas
public boolean cas(T expected, T newValue)
This method implements compare-and-swap- Parameters:
expected-newValue-- Returns:
- true if value was swapped, false otherwise
-
-