Skip to content

Commit b84ad20

Browse files
committed
Removed unecessary 'this' and type variables
1 parent c00408b commit b84ad20

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎exercises/binary-search-tree/.meta/src/reference/java/BinarySearchTree.java‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ void insert(T value) {
99
if (root == null) {
1010
root = new Node<>(value);
1111
} else {
12-
this.insert(this.root, value);
12+
insert(root, value);
1313
}
14-
this.nodeCount++;
14+
nodeCount++;
1515
}
1616

1717
List<T> getAsSortedList() {
18-
List<T> result = new ArrayList<>(this.nodeCount);
19-
this.putInSortedOrderToList(this.root, result);
18+
List<T> result = new ArrayList<>(nodeCount);
19+
putInSortedOrderToList(root, result);
2020
return Collections.unmodifiableList(result);
2121
}
2222

2323
List<T> getAsLevelOrderList() {
24-
List<T> result = new ArrayList<>(this.nodeCount);
25-
this.putInLevelOrderToList(this.root, result);
24+
List<T> result = new ArrayList<>(nodeCount);
25+
putInLevelOrderToList(root, result);
2626
return Collections.unmodifiableList(result);
2727
}
2828

@@ -33,13 +33,13 @@ Node<T> getRoot() {
3333
private void insert(Node<T> node, T value) {
3434
if (value.compareTo(node.getData()) <= 0) {
3535
if (node.getLeft() == null) {
36-
node.setLeft(new Node<T>(value));
36+
node.setLeft(new Node<>(value));
3737
} else {
3838
insert(node.getLeft(), value);
3939
}
4040
} else {
4141
if (node.getRight() == null) {
42-
node.setRight(new Node<T>(value));
42+
node.setRight(new Node<>(value));
4343
} else {
4444
insert(node.getRight(), value);
4545
}

0 commit comments

Comments
 (0)