Skip to content

Commit 3a7b50a

Browse files
authored
Merge pull request williamfiset#31 from navedrizvi/master
fixed comparison bug in removeAt method
2 parents c2ca86a + 2b0b5e0 commit 3a7b50a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

com/williamfiset/datastructures/dynamicarray/DynamicArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void add(T elem) {
4949

5050
// Removes an element at the specified index in this array.
5151
public T removeAt(int rm_index) {
52-
if (rm_index >= len && rm_index < 0) throw new IndexOutOfBoundsException();
52+
if (rm_index >= len || rm_index < 0) throw new IndexOutOfBoundsException();
5353
T data = arr[rm_index];
5454
T[] new_arr = (T[]) new Object[len-1];
5555
for (int i = 0, j = 0; i < len; i++, j++)

0 commit comments

Comments
 (0)