|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.shiftone.cache.util.LinkedList
This linked list is different from the java.util implementation in that it exposes access to the nodes themselves, allowing lower level manipulation. This ends up being rather critical when removing elements from a cache. Having a reference to the node allows it to be removed in constant time - rather than having to search for it first.
Constructor Summary | |
LinkedList()
Constructor LinkedList |
Method Summary | |
LinkedListNode |
addBefore(LinkedListNode node,
java.lang.Object obj)
Method addBefore (somewhat expensive - alloc) |
LinkedListNode |
addFirst(java.lang.Object obj)
adding an object to the list, making it the new first node. |
LinkedListNode |
addLast(java.lang.Object obj)
adding an object to the list, making it the new last node. |
void |
addNodeBefore(LinkedListNode nodeToAddBefore,
LinkedListNode newPreviousNode)
Method addNodeBefore |
java.lang.Object |
dequeue()
remove a node from the end of the list (list is being used like a queue). |
static void |
main(java.lang.String[] args)
Method main |
void |
moveToFirst(LinkedListNode node)
promotes this node to the front of the the list. |
void |
moveToLast(LinkedListNode node)
demotes this node to the end of the list. |
LinkedListNode |
peekFirst()
peek the first element without removing it. |
LinkedListNode |
peekLast()
peek the last element without removing it. |
java.lang.Object |
pop()
remove a node from the beginning of the list (list is being used like a stack) |
java.lang.Object |
remove(LinkedListNode node)
Removes the node from the list and returns the value of the former node. |
int |
size()
Method size |
java.lang.String |
toString()
Method toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LinkedList()
Method Detail |
public final LinkedListNode addFirst(java.lang.Object obj)
public final LinkedListNode addLast(java.lang.Object obj)
public final java.lang.Object dequeue()
public final java.lang.Object pop()
public final LinkedListNode peekFirst()
public final LinkedListNode peekLast()
public final void moveToFirst(LinkedListNode node)
public final void moveToLast(LinkedListNode node)
public final LinkedListNode addBefore(LinkedListNode node, java.lang.Object obj)
public final void addNodeBefore(LinkedListNode nodeToAddBefore, LinkedListNode newPreviousNode)
public final java.lang.Object remove(LinkedListNode node)
public int size()
public java.lang.String toString()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |