Class ConcurrentAppendOnlyChunkedList<E>
- java.lang.Object
-
- org.apache.activemq.artemis.utils.collections.ConcurrentAppendOnlyChunkedList<E>
-
public final class ConcurrentAppendOnlyChunkedList<E> extends java.lang.ObjectThis collection is a concurrent append-only list that grows in chunks.
It's safe to be used by many threads concurrently and has a max capacity ofInteger.MAX_VALUE.
-
-
Constructor Summary
Constructors Constructor Description ConcurrentAppendOnlyChunkedList(int chunkSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(E e)Appends the specified element to the end of this collection.voidaddAll(E[] elements)It appendselementsto the collection.Eget(int index)Returns the element at the specified position in this collection ornullif not found.intsize()It returns the number of elements currently added.E[]toArray(java.util.function.IntFunction<E[]> arrayAllocator)E[]toArray(java.util.function.IntFunction<E[]> arrayAllocator, int startIndex)Returns an array containing all of the elements in this collection in proper sequence (from first to last element).
arrayAllocatorwill be used to instantiate the array of the correct size with the right runtime type.
-
-
-
Method Detail
-
size
public int size()
It returns the number of elements currently added.
-
addAll
public void addAll(E[] elements)
It appendselementsto the collection.
-
get
public E get(int index)
Returns the element at the specified position in this collection ornullif not found.
-
add
public void add(E e)
Appends the specified element to the end of this collection.- Throws:
java.lang.NullPointerException- ifeisnull
-
toArray
public E[] toArray(java.util.function.IntFunction<E[]> arrayAllocator, int startIndex)
Returns an array containing all of the elements in this collection in proper sequence (from first to last element).
arrayAllocatorwill be used to instantiate the array of the correct size with the right runtime type.
-
-