Added a handy little rotateTo method to be able to quickly rotate to a specific node.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@740329 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2009-02-03 16:02:01 +00:00
parent c01e182cfd
commit ba706d134d
1 changed files with 11 additions and 0 deletions

View File

@ -105,6 +105,17 @@ public class LinkedNodeList<T extends LinkedNode<T>> {
return head = head.getNextCircular(); return head = head.getNextCircular();
} }
/**
* Move the head to the tail and returns the new head node.
*
* @return
*/
public void rotateTo(T head) {
assert head!=null: "Cannot rotate to a null head";
assert head.list == this : "Cannot rotate to a node not linked to this list";
this.head = head;
}
public int size() { public int size() {
return size; return size;
} }