Class DoubleLinkedList
java.lang.Object
com.sun.jdo.spi.persistence.utility.DoubleLinkedList
This class defines a thread-safe double linked-list.
The list is usable by any class that implements the
com.forte.util.Linkable interface. This class allows
a linkable object it be inserted or removed from anywhere
in the list.
RESTRICTION: An object can only be a member of 1 list
at a time.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetHead()Return the object at the head of a linked list.intgetSize()Return size of the linked list.getTail()Return the object at the tail of a linked list.voidinsertAtHead(Linkable node) Insert an object at the head of a linked list.voidinsertAtTail(Linkable node) Insert an object at the tail of a linked list.voidinsertIntoList(Linkable afternode, Linkable newnode) Insert an object anywhere into the linked list.Remove and return an object from the head of a linked list.voidremoveFromList(Linkable node) Remove the specified object from anywhere in the linked list.Remove and return an object from the tail of a linked list.toString()Return a string representation of this DoubleLinkedList object.
-
Field Details
-
head
Head of linked list. -
tail
Tail of linked list. -
size
public int sizeSize of linked list.
-
-
Constructor Details
-
DoubleLinkedList
public DoubleLinkedList()Default constructor.
-
-
Method Details
-
getHead
Return the object at the head of a linked list. -
getTail
Return the object at the tail of a linked list. -
getSize
public int getSize()Return size of the linked list. -
insertAtHead
Insert an object at the head of a linked list. -
insertAtTail
Insert an object at the tail of a linked list. -
removeFromHead
Remove and return an object from the head of a linked list. -
removeFromTail
Remove and return an object from the tail of a linked list. -
removeFromList
Remove the specified object from anywhere in the linked list. This method is usually used by the object to remove itself from the list. -
insertIntoList
Insert an object anywhere into the linked list.- Parameters:
afternode- the new node will be inserted after this nodenewnode- the new node to be inserted
-
toString
Return a string representation of this DoubleLinkedList object.
-