Class AtomicArray<E>
java.lang.Object
org.opensearch.common.util.concurrent.AtomicArray<E>
A list backed by an
AtomicReferenceArray
with potential null values, easily allowing
to get the concrete values as a list using asList()
.- Opensearch.api:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasList()
Returns the it as a non null list.get
(int i) Gets the current value at positioni
.int
length()
The size of the expected results, including potential null values.void
Sets the element at positioni
to the given value.final void
E[]
Copies the content of the underlying atomic array to a normal one.
-
Constructor Details
-
AtomicArray
public AtomicArray(int size)
-
-
Method Details
-
length
public int length()The size of the expected results, including potential null values. -
set
Sets the element at positioni
to the given value.- Parameters:
i
- the indexvalue
- the new value
-
setOnce
-
get
Gets the current value at positioni
.- Parameters:
i
- the index- Returns:
- the current value
-
asList
Returns the it as a non null list. -
toArray
Copies the content of the underlying atomic array to a normal one.
-