- public static <T> int halfSearch(List<? extends Comparable<? super T>> list,T key)
- {
- int max,min,mid;
- max=list.size()-1;
- min=0;
-
- while(min<=max)
- {
- mid=(max+min)>>1;
- T t =list.get(mid);
- int num = t.compareTo(key);
- if(num>0)
- max=mid-1;
- else if(num<0)
- min=mid+1;
- else return mid;
- }
- return -min-1;
- }
复制代码
这个代码为什么会编译不通过呢 |