Class RecyclingLinkedList

All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, SequencedCollection

public class RecyclingLinkedList extends SafeLinkedList implements Cloneable, Serializable
Extends SafeLinkedList and adds recycling of Node objects.
Author:
cp 2002.01.06
See Also:
  • Field Details

    • m_anodeRecycled

      protected transient RecyclingLinkedList.Node[] m_anodeRecycled
      The Nodes to recycle.
    • m_cRecycleNodes

      protected transient int m_cRecycleNodes
      The current number of Nodes being recycle.
    • m_cRecycleMax

      protected int m_cRecycleMax
      The maximum number of Nodes to recycle.
    • DEFAULT_RECYCLE_MAX

      protected static final int DEFAULT_RECYCLE_MAX
      The default maximum number of Nodes to recycle.
      See Also:
  • Constructor Details

    • RecyclingLinkedList

      public RecyclingLinkedList()
      Construct an empty List.
    • RecyclingLinkedList

      public RecyclingLinkedList(int cMaxRecycle)
      Construct an empty List.
      Parameters:
      cMaxRecycle - the maximum number of Nodes to recycle at any given time
    • RecyclingLinkedList

      public RecyclingLinkedList(Collection collection)
      Construct a List containing the elements of the specified Collection.
      Parameters:
      collection - the Collection to fill this List from
    • RecyclingLinkedList

      public RecyclingLinkedList(Collection collection, int cMaxRecycle)
      Construct a List containing the elements of the specified Collection.
      Parameters:
      collection - the Collection to fill this List from
      cMaxRecycle - the maximum number of Nodes to recycle at any given time
  • Method Details

    • initRecycling

      protected void initRecycling(int cMaxRecycle)
      Initializing the recycling data structures.
      Parameters:
      cMaxRecycle - the maximum number of Nodes to recycle at any given time
    • instantiateNode

      protected SafeLinkedList.Node instantiateNode(Object o)
      Instantiate a Node. (Factory pattern.) This method is over-ridden by inheriting implementations if the inheriting implementation extends the inner Node class.
      Overrides:
      instantiateNode in class SafeLinkedList
      Parameters:
      o - the value for the Node
    • recycleNode

      protected void recycleNode(RecyclingLinkedList.Node node)
      Recycle the passed Node.
      Parameters:
      node - the Node object to recycle
    • clone

      public Object clone()
      Create a deep clone of the list.
      Overrides:
      clone in class SafeLinkedList
      Returns:
      a clone of this list