Top Description Constructors Methods
com.google.common.util.concurrent

public final Class Atomics

extends Object
Class Inheritance
Annotations
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtIncompatible, java.util.concurrent.atomic.AtomicReference, .AtomicReferenceArray, org.checkerframework.checker.nullness.qual.Nullable

Static utility methods pertaining to classes in the java.util.concurrent.atomic package.
Author
Kurt Alfred Kluever
Since
10.0

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <V> AtomicReference<@Nullable V>

Returns:

a new AtomicReference with no initial value
newReference
()

Creates an AtomicReference instance with no initial value.

public static <V extends @Nullable Object> AtomicReference<V>

Returns:

a new AtomicReference with the given initial value
newReference
(V
the initial value
initialValue
)

Creates an AtomicReference instance with the given initial value.

public static <E> AtomicReferenceArray<@Nullable E>

Returns:

a new AtomicReferenceArray with the given length
newReferenceArray
(int
the length of the array
length
)

Creates an AtomicReferenceArray instance of given length.

public static <E extends @Nullable Object> AtomicReferenceArray<E>

Returns:

a new AtomicReferenceArray copied from the given array
newReferenceArray
(E[]
the array to copy elements from
array
)

Creates an AtomicReferenceArray instance with the same length as, and all elements copied from, the given array.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Atomicsback to summary
private Atomics()

Method Detail

newReferenceback to summary
public static <V> AtomicReference<@Nullable V> newReference()

Creates an AtomicReference instance with no initial value.

Returns:AtomicReference<@Nullable V>

a new AtomicReference with no initial value

newReferenceback to summary
public static <V extends @Nullable Object> AtomicReference<V> newReference(V initialValue)

Creates an AtomicReference instance with the given initial value.

Parameters
initialValue:V

the initial value

Returns:AtomicReference<V>

a new AtomicReference with the given initial value

newReferenceArrayback to summary
public static <E> AtomicReferenceArray<@Nullable E> newReferenceArray(int length)

Creates an AtomicReferenceArray instance of given length.

Parameters
length:int

the length of the array

Returns:AtomicReferenceArray<@Nullable E>

a new AtomicReferenceArray with the given length

newReferenceArrayback to summary
public static <E extends @Nullable Object> AtomicReferenceArray<E> newReferenceArray(E[] array)

Creates an AtomicReferenceArray instance with the same length as, and all elements copied from, the given array.

Parameters
array:E[]

the array to copy elements from

Returns:AtomicReferenceArray<E>

a new AtomicReferenceArray copied from the given array