Class AtomicArray<E>
- java.lang.Object
-
- org.elasticsearch.common.util.concurrent.AtomicArray<E>
-
public class AtomicArray<E> extends java.lang.Object
A list backed by anAtomicReferenceArray
with potential null values, easily allowing to get the concrete values as a list usingasList()
.
-
-
Constructor Summary
Constructors Constructor Description AtomicArray(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<E>
asList()
Returns the it as a non null list.E
get(int i)
Gets the current value at positioni
.int
length()
The size of the expected results, including potential null values.void
set(int i, E value)
Sets the element at positioni
to the given value.void
setOnce(int i, E value)
E[]
toArray(E[] a)
Copies the content of the underlying atomic array to a normal one.
-
-
-
Method Detail
-
length
public int length()
The size of the expected results, including potential null values.
-
set
public void set(int i, E value)
Sets the element at positioni
to the given value.- Parameters:
i
- the indexvalue
- the new value
-
setOnce
public final void setOnce(int i, E value)
-
get
public E get(int i)
Gets the current value at positioni
.- Parameters:
i
- the index- Returns:
- the current value
-
asList
public java.util.List<E> asList()
Returns the it as a non null list.
-
-