Class Atomics
- java.lang.Object
-
- com.google.common.util.concurrent.Atomics
-
@GwtIncompatible public final class Atomics extends java.lang.Object
Static utility methods pertaining to classes in thejava.util.concurrent.atomicpackage.- Since:
- 10.0
- Author:
- Kurt Alfred Kluever
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V> java.util.concurrent.atomic.AtomicReference<@Nullable V>newReference()Creates anAtomicReferenceinstance with no initial value.static <V extends @Nullable java.lang.Object>
java.util.concurrent.atomic.AtomicReference<V>newReference(V initialValue)Creates anAtomicReferenceinstance with the given initial value.static <E> java.util.concurrent.atomic.AtomicReferenceArray<@Nullable E>newReferenceArray(int length)Creates anAtomicReferenceArrayinstance of given length.static <E extends @Nullable java.lang.Object>
java.util.concurrent.atomic.AtomicReferenceArray<E>newReferenceArray(E[] array)Creates anAtomicReferenceArrayinstance with the same length as, and all elements copied from, the given array.
-
-
-
Method Detail
-
newReference
public static <V> java.util.concurrent.atomic.AtomicReference<@Nullable V> newReference()
Creates anAtomicReferenceinstance with no initial value.- Returns:
- a new
AtomicReferencewith no initial value
-
newReference
public static <V extends @Nullable java.lang.Object> java.util.concurrent.atomic.AtomicReference<V> newReference(V initialValue)
Creates anAtomicReferenceinstance with the given initial value.- Parameters:
initialValue- the initial value- Returns:
- a new
AtomicReferencewith the given initial value
-
newReferenceArray
public static <E> java.util.concurrent.atomic.AtomicReferenceArray<@Nullable E> newReferenceArray(int length)
Creates anAtomicReferenceArrayinstance of given length.- Parameters:
length- the length of the array- Returns:
- a new
AtomicReferenceArraywith the given length
-
newReferenceArray
public static <E extends @Nullable java.lang.Object> java.util.concurrent.atomic.AtomicReferenceArray<E> newReferenceArray(E[] array)
Creates anAtomicReferenceArrayinstance with the same length as, and all elements copied from, the given array.- Parameters:
array- the array to copy elements from- Returns:
- a new
AtomicReferenceArraycopied from the given array
-
-