import java.util.ArrayList;import java.util.Collections;import java.util.List;public class CollectionsDemo { public static void main(String[] args) { demo1(); } public static void demo1(){ List list = new ArrayList<>(); list.add("JACK"); list.add("TOM"); list.add("LILY"); list.add("LIU"); list.add("ZHANG"); list.add("GUI"); // Collections.reverse(list);// Collections.shuffle(list);// Collections.sort(list); //Collections.sort(list,Comparator c); 自定义比较器// Collections.swap(list,0,1);// Collections.rotate(list,1); System.out.println(list); //二分查找时一定要先排序 Collections.sort(list); int tomIndex = Collections.binarySearch(list, "TOM"); System.out.println(list.get(tomIndex)); System.out.println(Collections.max(list)); System.out.println(Collections.min(list));// Collections.fill(list,"刘铂西"); System.out.println(list);// System.out.println(Collections.frequency(list,"刘铂西"));// Collections.replaceAll(list,"刘铂西","lsq666"); System.out.println(list); List