Fix linter warnings
parent
a1ea0f3bf3
commit
5962d43f20
|
@ -220,20 +220,16 @@ public class AVLTree<K extends Comparable<K>,V> implements Iterable<AVLTree.Entr
|
||||||
int balance = this.balance();
|
int balance = this.balance();
|
||||||
if (balance > 1) {
|
if (balance > 1) {
|
||||||
ValueNode<K, V> l = this.left.toValueNode();
|
ValueNode<K, V> l = this.left.toValueNode();
|
||||||
if (l.balance() > 0) { // left-left case
|
if (l.balance() <= 0) { // left-right case
|
||||||
return this.rotateRight();
|
|
||||||
} else { // left-right case
|
|
||||||
this.left = l.rotateLeft();
|
this.left = l.rotateLeft();
|
||||||
return this.rotateRight();
|
|
||||||
}
|
}
|
||||||
|
return this.rotateRight();
|
||||||
} else if (balance < -1) {
|
} else if (balance < -1) {
|
||||||
ValueNode<K, V> r = this.right.toValueNode();
|
ValueNode<K, V> r = this.right.toValueNode();
|
||||||
if (r.balance() > 0) { // right-left case
|
if (r.balance() > 0) { // right-left case
|
||||||
this.right = r.rotateRight();
|
this.right = r.rotateRight();
|
||||||
return this.rotateLeft();
|
|
||||||
} else { // right-right case
|
|
||||||
return this.rotateLeft();
|
|
||||||
}
|
}
|
||||||
|
return this.rotateLeft();
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -467,8 +463,8 @@ public class AVLTree<K extends Comparable<K>,V> implements Iterable<AVLTree.Entr
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Entry<K, V> {
|
public static class Entry<K, V> {
|
||||||
private K key;
|
private final K key;
|
||||||
private V val;
|
private final V val;
|
||||||
|
|
||||||
public Entry(K key, V val) {
|
public Entry(K key, V val) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
|
Loading…
Reference in New Issue