import java.util.Collections; import java.util.LinkedList; import java.util.List; public class Test { List list = new LinkedList(); public static void main(String[] args) { List list = new LinkedList(); for ( int i = 0 ; i < 9 ; i ++ ) { list.add( " a " + i); } Collections.sort(list); // 顺序排列 System.out.println(list); Collections.shuffle(list); // 混乱的意思 System.out.println(list); Collections.reverse(list); // 倒序排列 System.out.println(list); System.out.println(Collections.binarySearch(list, " a5 " )); // 折半查找 } }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/19433.html