public final class SparseArrayLinkedList<T> extends Object
T.UnrolledLinkedList this list doesn't optimize addition and removal to achieve a balanced
utilization among chunks ie a chunk is removed only if empty and chunks can't be merged.
This list has been optimized for small-sized chunks (ideally <= 32 elements): this allow search/removal to
be performed with a greedy approach despite a sparse chunk utilization (ie chunks contains few sparse elements).| Constructor and Description |
|---|
SparseArrayLinkedList() |
SparseArrayLinkedList(int sparseArrayCapacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(T e)
Appends
e to the end of this list. |
static <T> void |
addToSparseArrayList(List<org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList.SparseArray<T>> sparseArrayList,
T e,
int sparseArrayCapacity) |
long |
clear(java.util.function.Consumer<? super T> consumer)
Clear while consuming (using the given
consumer all the elements of this list. |
static <T> long |
clearSparseArrayList(List<org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList.SparseArray<T>> sparseArrayList,
java.util.function.Consumer<? super T> consumer) |
long |
remove(java.util.function.Predicate<? super T> filter)
Removes any element of the list matching the given predicate.
|
static <T> long |
removeFromSparseArrayList(List<org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList.SparseArray<T>> sparseArrayList,
java.util.function.Predicate<? super T> filter) |
long |
size()
Returns the number of elements of this list.
|
int |
sparseArrayCapacity()
Returns the configured capacity of each sparse array/chunk.
|
int |
sparseArraysCount()
Returns the number of sparse arrays/chunks of this list.
|
public SparseArrayLinkedList()
public SparseArrayLinkedList(int sparseArrayCapacity)
public static <T> long removeFromSparseArrayList(List<org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList.SparseArray<T>> sparseArrayList, java.util.function.Predicate<? super T> filter)
public static <T> void addToSparseArrayList(List<org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList.SparseArray<T>> sparseArrayList, T e, int sparseArrayCapacity)
public static <T> long clearSparseArrayList(List<org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList.SparseArray<T>> sparseArrayList, java.util.function.Consumer<? super T> consumer)
public void add(T e)
e to the end of this list.public long remove(java.util.function.Predicate<? super T> filter)
public long clear(java.util.function.Consumer<? super T> consumer)
consumer all the elements of this list.public long size()
public int sparseArrayCapacity()
public int sparseArraysCount()
Copyright © 2020 The Apache Software Foundation. All Rights Reserved.