Class ConcurrentAppendOnlyChunkedList<E>
java.lang.Object
org.apache.activemq.artemis.utils.collections.ConcurrentAppendOnlyChunkedList<E>
This 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 of Integer.MAX_VALUE.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAppends the specified element to the end of this collection.voidIt appendselementsto the collection.get(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(IntFunction<E[]> arrayAllocator) E[]toArray(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.
-
Constructor Details
-
ConcurrentAppendOnlyChunkedList
public ConcurrentAppendOnlyChunkedList(int chunkSize) - Throws:
IllegalArgumentException- ifchunkSizeis <0 or not a power of 2
-
-
Method Details
-
size
public int size()It returns the number of elements currently added. -
addAll
It appendselementsto the collection. -
get
Returns the element at the specified position in this collection ornullif not found..- Returns:
- the element at the specified position in this collection or
nullif not found.
-
add
Appends the specified element to the end of this collection.- Throws:
NullPointerException- ifeisnull
-
toArray
-
toArray
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.- 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
-