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