Class DoubleLinkedList<T extends DoubleLinkedListNode>

java.lang.Object
org.apache.commons.jcs3.utils.struct.DoubleLinkedList<T>

public class DoubleLinkedList<T extends DoubleLinkedListNode> extends Object
This is a generic thread safe double linked list. It's very simple and all the operations are so quick that course grained synchronization is more than acceptable.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addFirst(T me)
    Adds a new node to the start of the link list.
    void
    addLast(T me)
    Adds a new node to the end of the link list.
    void
    Dump the cache entries from first to list for debugging.
    Removes the specified node from the link list.
    Returns the last node from the link list, if there are any nodes.
    void
    Moves an existing node to the start of the link list.
    void
    makeLast(T ln)
    Moves an existing node to the end of the link list.
    boolean
    remove(T me)
    Removes the specified node from the link list.
    void
    Remove all of the elements from the linked list implementation.
    Removes the specified node from the link list.
    int
    Returns the size of the list.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • addLast

      public void addLast(T me)
      Adds a new node to the end of the link list.

      Parameters:
      me - The feature to be added to the Last
    • addFirst

      public void addFirst(T me)
      Adds a new node to the start of the link list.

      Parameters:
      me - The feature to be added to the First
    • getLast

      public T getLast()
      Returns the last node from the link list, if there are any nodes.

      Returns:
      The last node.
    • getFirst

      public T getFirst()
      Removes the specified node from the link list.

      Returns:
      DoubleLinkedListNode, the first node.
    • makeFirst

      public void makeFirst(T ln)
      Moves an existing node to the start of the link list.

      Parameters:
      ln - The node to set as the head.
    • makeLast

      public void makeLast(T ln)
      Moves an existing node to the end of the link list.

      Parameters:
      ln - The node to set as the head.
    • removeAll

      public void removeAll()
      Remove all of the elements from the linked list implementation.
    • remove

      public boolean remove(T me)
      Removes the specified node from the link list.

      Parameters:
      me - Description of the Parameter
      Returns:
      true if an element was removed.
    • removeLast

      public T removeLast()
      Removes the specified node from the link list.

      Returns:
      The last node if there was one to remove.
    • size

      public int size()
      Returns the size of the list.

      Returns:
      int
    • debugDumpEntries

      public void debugDumpEntries()
      Dump the cache entries from first to list for debugging.