Class NodeCachingLinkedList

  • All Implemented Interfaces:, java.lang.Iterable, java.util.Collection, java.util.List

    public class NodeCachingLinkedList
    extends AbstractLinkedList
    Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.
    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.

    Commons Collections 3.0
    See Also:
    Serialized Form
    • Constructor Detail

      • NodeCachingLinkedList

        public NodeCachingLinkedList()
        Constructor that creates.
      • NodeCachingLinkedList

        public NodeCachingLinkedList​(java.util.Collection coll)
        Constructor that copies the specified collection
        coll - the collection to copy
      • NodeCachingLinkedList

        public NodeCachingLinkedList​(int maximumCacheSize)
        Constructor that species the maximum cache size.
        maximumCacheSize - the maximum cache size