Class Atomics
java.lang.Object
com.google.common.util.concurrent.Atomics
Static utility methods pertaining to classes in the
java.util.concurrent.atomic
package.- Since:
- 10.0
- Author:
- Kurt Alfred Kluever
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V> AtomicReference
<@Nullable V> Creates anAtomicReference
instance with no initial value.static <V extends @Nullable Object>
AtomicReference<V> newReference
(V initialValue) Creates anAtomicReference
instance with the given initial value.static <E> AtomicReferenceArray
<@Nullable E> newReferenceArray
(int length) Creates anAtomicReferenceArray
instance of given length.static <E extends @Nullable Object>
AtomicReferenceArray<E> newReferenceArray
(E[] array) Creates anAtomicReferenceArray
instance with the same length as, and all elements copied from, the given array.
-
Method Details
-
newReference
Creates anAtomicReference
instance with no initial value.- Returns:
- a new
AtomicReference
with no initial value
-
newReference
Creates anAtomicReference
instance with the given initial value.- Parameters:
initialValue
- the initial value- Returns:
- a new
AtomicReference
with the given initial value
-
newReferenceArray
Creates anAtomicReferenceArray
instance of given length.- Parameters:
length
- the length of the array- Returns:
- a new
AtomicReferenceArray
with the given length
-
newReferenceArray
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
-