Author: ggregory
Date: Thu Oct 30 12:24:46 2014
New Revision: 1635476
URL: http://svn.apache.org/r1635476
Log:
Statement unnecessarily nested within else clause.
Modified:
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/TreeList.java
Modified:
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/TreeList.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/TreeList.java?rev=1635476&r1=1635475&r2=1635476&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/TreeList.java
(original)
+++
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/TreeList.java
Thu Oct 30 12:24:46 2014
@@ -865,48 +865,41 @@ public class TreeList<E> extends Abstrac
s = sAncestor.balance();
}
return s;
- } else {
- // CASE 2: This tree is taller. This is symmetric to case 1.
- // We merge otherTree into this tree by finding a subtree s of
this
- // tree that is of similar height to otherTree and replacing it
- // with a new subtree whose root is otherTreeMin and whose
- // children are otherTree and s.
-
- otherTree = otherTree.removeMin();
-
- final ArrayStack<AVLNode<E>> sAncestors = new
ArrayStack<AVLNode<E>>();
- AVLNode<E> s = this;
- int sAbsolutePosition = s.relativePosition;
- int sParentAbsolutePosition = 0;
- while (s != null && s.height > getHeight(otherTree)) {
- sParentAbsolutePosition = sAbsolutePosition;
- sAncestors.push(s);
- s = s.right;
- if (s != null) {
- sAbsolutePosition += s.relativePosition;
- }
- }
+ }
+ otherTree = otherTree.removeMin();
- otherTreeMin.setRight(otherTree, null);
- otherTreeMin.setLeft(s, maxNode);
- if (otherTree != null) {
- otherTree.min().setLeft(null, otherTreeMin);
- otherTree.relativePosition++;
- }
+ final ArrayStack<AVLNode<E>> sAncestors = new
ArrayStack<AVLNode<E>>();
+ AVLNode<E> s = this;
+ int sAbsolutePosition = s.relativePosition;
+ int sParentAbsolutePosition = 0;
+ while (s != null && s.height > getHeight(otherTree)) {
+ sParentAbsolutePosition = sAbsolutePosition;
+ sAncestors.push(s);
+ s = s.right;
if (s != null) {
- s.max().setRight(null, otherTreeMin);
- s.relativePosition = sAbsolutePosition - currentSize;
+ sAbsolutePosition += s.relativePosition;
}
- otherTreeMin.relativePosition = currentSize -
sParentAbsolutePosition;
+ }
- s = otherTreeMin;
- while (!sAncestors.isEmpty()) {
- final AVLNode<E> sAncestor = sAncestors.pop();
- sAncestor.setRight(s, null);
- s = sAncestor.balance();
- }
- return s;
+ otherTreeMin.setRight(otherTree, null);
+ otherTreeMin.setLeft(s, maxNode);
+ if (otherTree != null) {
+ otherTree.min().setLeft(null, otherTreeMin);
+ otherTree.relativePosition++;
+ }
+ if (s != null) {
+ s.max().setRight(null, otherTreeMin);
+ s.relativePosition = sAbsolutePosition - currentSize;
+ }
+ otherTreeMin.relativePosition = currentSize -
sParentAbsolutePosition;
+
+ s = otherTreeMin;
+ while (!sAncestors.isEmpty()) {
+ final AVLNode<E> sAncestor = sAncestors.pop();
+ sAncestor.setRight(s, null);
+ s = sAncestor.balance();
}
+ return s;
}
// private void checkFaedelung() {