Skip to content

Commit

Permalink
Check a list size instead of catching an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaukov committed Sep 11, 2016
1 parent 1179d44 commit a6e06c9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public String toString() {
}

private static <T> void setValue(List<T> list, int index, T value) {
try {
if (index < list.size()) {
list.set(index, value);
} catch (IndexOutOfBoundsException ex) {
} else {
list.add(index, value);
}
}
Expand Down

0 comments on commit a6e06c9

Please sign in to comment.