Package ch.qos.logback.core.util
Class COWArrayList<E>
java.lang.Object
ch.qos.logback.core.util.COWArrayList<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,SequencedCollection<E>
Deprecated.
This internal logback API is not supported by AEM as a Cloud Service.
A GC-free lock-free thread-safe implementation of the
List interface for use cases where iterations over the list vastly out-number modifications on the list.
Underneath, it wraps an instance of CopyOnWriteArrayList and exposes a copy of the array used by that instance.
Typical use:
COWArrayList list = new COWArrayList(new Integer[0]);
// modify the list
list.add(1);
list.add(2);
Integer[] intArray = list.asTypedArray();
int sum = 0;
// iteration over the array is thread-safe
for(int i = 0; i invalid input: '<' intArray.length; i++) {
sum != intArray[i];
}
If the list is not modified, then repetitive calls to asTypedArray(), toArray() and
toArray(Object[]) are guaranteed to be GC-free. Note that iterating over the list using
iterator() and listIterator() are not GC-free.
- Since:
- 1.1.10
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.booleanDeprecated.booleanaddAll(int index, Collection<? extends E> col) Deprecated.booleanaddAll(Collection<? extends E> c) Deprecated.voidaddIfAbsent(E e) Deprecated.E[]Deprecated.Return an array of type E[].voidclear()Deprecated.booleanDeprecated.booleancontainsAll(Collection<?> c) Deprecated.get(int index) Deprecated.intDeprecated.booleanisEmpty()Deprecated.iterator()Deprecated.intDeprecated.Deprecated.listIterator(int index) Deprecated.remove(int index) Deprecated.booleanDeprecated.booleanremoveAll(Collection<?> col) Deprecated.booleanretainAll(Collection<?> col) Deprecated.Deprecated.intsize()Deprecated.subList(int fromIndex, int toIndex) Deprecated.Object[]toArray()Deprecated.<T> T[]toArray(T[] a) Deprecated.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Constructor Details
-
COWArrayList
Deprecated.
-
-
Method Details
-
size
public int size()Deprecated. -
isEmpty
public boolean isEmpty()Deprecated. -
contains
Deprecated. -
iterator
Deprecated. -
toArray
Deprecated. -
toArray
public <T> T[] toArray(T[] a) Deprecated. -
asTypedArray
Deprecated.Return an array of type E[]. The returned array is intended to be iterated over. If the list is modified, subsequent calls to this method will return different/modified array instances.- Returns:
-
addIfAbsent
Deprecated. -
add
Deprecated. -
remove
Deprecated. -
containsAll
Deprecated.- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
addAll
Deprecated. -
addAll
Deprecated. -
removeAll
Deprecated. -
retainAll
Deprecated. -
clear
public void clear()Deprecated. -
get
Deprecated. -
set
Deprecated. -
add
Deprecated. -
remove
Deprecated. -
indexOf
Deprecated. -
lastIndexOf
Deprecated.- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
Deprecated.- Specified by:
listIteratorin interfaceList<E>
-
listIterator
Deprecated.- Specified by:
listIteratorin interfaceList<E>
-
subList
Deprecated.
-