Skip to content

Commit

Permalink
Reverting to no error handling on dynamic array to keep example simpl…
Browse files Browse the repository at this point in the history
…e. Added a comment in the lecture notes explaining.
  • Loading branch information
jrasmusson committed Sep 14, 2020
1 parent bba5b5c commit b4cff9c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/main/java/datastructures/DynamicArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ public String get(int index) {
}

public void set(int index, String value) {
if (index <= size) {
data[index] = value;
} else {
throw new IndexOutOfBoundsException("Index is too big!");
}
data[index] = value;
}

public void insert(int index, String value) {
Expand Down
1 change: 1 addition & 0 deletions src/test/java/datastructures/DynamicArrayTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ public void Contains() {
array.delete(0);
Assert.assertFalse(array.Contains("a"));
}

}

0 comments on commit b4cff9c

Please sign in to comment.