public class Demo1_Collections {
public static void main(String[] args) {
// TODO Auto-generated method stub
//demo1();
ArrayList<String> al = new ArrayList<>();
al.add("a");
al.add("c");
al.add("d");
al.add("g");
al.add("f");
System.out.println(Collections.binarySearch(al, "c"));
System.out.println(Collections.binarySearch(al, "f"));
}
为什么f输出来是 -4 |
|