Made fixInsertion return the new root

This changes RedBlackNode.fixInsertion to return the root of the resulting tree.
This commit is contained in:
Bill Jacobs
2016-05-26 10:37:25 -07:00
parent f7f14ff852
commit 82c1fbdc7b
4 changed files with 40 additions and 20 deletions

View File

@@ -133,10 +133,7 @@ public class TreeList<T> extends AbstractList<T> {
newNode.parent = node;
}
newNode.fixInsertion();
while (root.parent != null) {
root = root.parent;
}
root = newNode.fixInsertion();
}
@Override
@@ -418,7 +415,7 @@ public class TreeList<T> extends AbstractList<T> {
}
prevNode = newNode;
newNode.fixInsertion();
root = newNode.fixInsertion();
nextIndex++;
haveModified = true;
TreeList.this.modCount++;