Skip to content

Commit

Permalink
Avoiding out-of-range exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed May 4, 2016
1 parent 634ea1d commit 38cb890
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -299,6 +299,7 @@ public static <T> Iterable<T> range(Iterable<T> items, int from, int to) {
}

List<?> list = (items instanceof List<?>) ? (List<?>) items : U.list(items);
to = Math.min(to, list.size());
return U.cast(list.subList(from, to));
}

Expand Down

0 comments on commit 38cb890

Please sign in to comment.