标题: Collections工具类 [打印本页] 作者: 晨若兰曦 时间: 2014-12-29 21:56 标题: Collections工具类 public class CollectionsDemo {
public static void main(String[] args) {
binarySearch();
}
public static void binarySearch() {
List<String> list = new ArrayList<String>();
list.add("abfn");
list.add("aaaa");
list.add("aaaa");
list.add("bhfe");
Collections.sort(list);
sop(list);
int index = Collections.binarySearch(list, "aaaa");
sop("index=" + index);