Class NodeCachingLinkedList<E>
java.lang.Object
org.apache.commons.collections4.list.AbstractLinkedList<E>
org.apache.commons.collections4.list.NodeCachingLinkedList<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,List<E>,SequencedCollection<E>
A
List implementation that stores a cache of internal Node objects
in an effort to reduce wasteful object creation.
A linked list creates one Node for each item of data added. This can result in a lot of object creation and garbage collection. This implementation seeks to avoid that by maintaining a store of cached nodes.
This implementation is suitable for long-lived lists where both add and remove are used. Short-lived lists, or lists which only grow will have worse performance using this class.
Note that this implementation is not synchronized.
- Since:
- 3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor that creates.NodeCachingLinkedList(int maximumCacheSize) Constructor that species the maximum cache size.NodeCachingLinkedList(Collection<? extends E> coll) Constructor that copies the specified collection -
Method Summary
Methods inherited from class org.apache.commons.collections4.list.AbstractLinkedList
add, add, addAll, addAll, addFirst, addLast, clear, contains, containsAll, equals, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeLast, retainAll, set, size, subList, toArray, toArray, toStringMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
replaceAll, reversed, sort, spliterator
-
Constructor Details
-
NodeCachingLinkedList
public NodeCachingLinkedList()Constructor that creates. -
NodeCachingLinkedList
Constructor that copies the specified collection- Parameters:
coll- the collection to copy
-
NodeCachingLinkedList
public NodeCachingLinkedList(int maximumCacheSize) Constructor that species the maximum cache size.- Parameters:
maximumCacheSize- the maximum cache size
-