public final class Atomics extends Object
Static utility methods pertaining to classes in the java.util.concurrent.atomic package.
| Modifier and Type | Method and Description |
|---|---|
static <V> AtomicReference<V> |
newReference()
Creates an
AtomicReference instance with no initial value. |
static <V> AtomicReference<V> |
newReference(V initialValue)
Creates an
AtomicReference instance with the given initial value. |
static <E> AtomicReferenceArray<E> |
newReferenceArray(E[] array)
Creates an
AtomicReferenceArray instance with the same length as, and all elements copied from, the given array. |
static <E> AtomicReferenceArray<E> |
newReferenceArray(int length)
Creates an
AtomicReferenceArray instance of given length. |
public static <V> AtomicReference<V> newReference()
Creates an AtomicReference instance with no initial value.
AtomicReference with no initial valuepublic static <V> AtomicReference<V> newReference(@Nullable V initialValue)
Creates an AtomicReference instance with the given initial value.
initialValue - the initial valueAtomicReference with the given initial valuepublic static <E> AtomicReferenceArray<E> newReferenceArray(int length)
Creates an AtomicReferenceArray instance of given length.
length - the length of the arrayAtomicReferenceArray with the given lengthpublic static <E> AtomicReferenceArray<E> newReferenceArray(E[] array)
Creates an AtomicReferenceArray instance with the same length as, and all elements copied from, the given array.
array - the array to copy elements fromAtomicReferenceArray copied from the given array