1.简单的list的排序
List<Integer> asList = Arrays.asList(1,2,5,7,8,3,6,0,9);
//倒序
Collections.sort(asList,Collections.reverseOrder());
//正序
Collections.sort(asList);
//根据数组原有顺序进行倒序
Collections.reverse(asList);
//混乱排序
Collections.shuffle(asList);
对象的list的排序
正序:
list.sort(Comparator.comparing(a::getAge));
逆序
list.sort(Comparator.comparing(a::getAge).reversed());