提交 6d9cc46d 编写于 作者: K Kohsuke Kawaguchi

off by one bug.

上级 b0fb0992
......@@ -153,7 +153,7 @@ class SortedIntList extends AbstractList<Integer> {
* Switch to {@code java.util.Arrays.binarySearch} when we depend on Java6.
*/
private static int binarySearch(int[] a, int start, int end, int key) {
int lo = start, hi = end+1;
int lo = start, hi = end-1; // search range is [lo,hi]
// invariant lo<=hi
while (lo <= hi) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册