Fix IntegerList.binarySearch

This commit is contained in:
Sam Harwell 2012-07-30 19:24:20 -05:00
parent 7d4f71d829
commit 8c820269e4
1 changed files with 5 additions and 1 deletions

View File

@ -259,10 +259,14 @@ public class IntegerList {
}
public final int binarySearch(int key) {
return Arrays.binarySearch(_data, key);
return Arrays.binarySearch(_data, 0, _size, key);
}
public final int binarySearch(int fromIndex, int toIndex, int key) {
if (fromIndex < 0 || toIndex < 0 || fromIndex > _size || toIndex > _size) {
throw new IndexOutOfBoundsException();
}
return Arrays.binarySearch(_data, fromIndex, toIndex, key);
}