...
ArrayList简单排序
public static void main(String[] args) {
List list = new ArrayList();
list.add(6);
list.add(9);
list.add(3);
//从小到大方法:[3, 6, 9]
Collections.sort(list);
System.out.println(list);
//从大到小方法:[9, 6, 3]
Collections.sort(list, Collections.reverseOrder());
System.out.println(list);
}
更多精彩,请点击此链接✈✈✈✈✈✈