参考:
http://www.cnblogs.com/nayitian/p/3269585.html
public static void main(String[] args) {
// TODO Auto-generated method stub
List<Integer> pokerList = new ArrayList<Integer>();
pokerList.add(13);
pokerList.add(14);
pokerList.add(3);
System.out.println("远顺序:" + pokerList);
//1) 排序(由小到大)
//Collections.sort(pokerList);
//System.out.println("sort后顺序:" + pokerList);
//2)倒置/反转
//Collections.reverse(pokerList);
//System.out.println("reverse后顺序:" + pokerList);
//3)排序(由大到小)
//Collections.sort(pokerList,Collections.reverseOrder());
//System.out.println("由大到小排序:" + pokerList);
//3)排序(由大到小)
Collections.sort(pokerList); //先 由小岛大
Collections.reverse(pokerList); //再 反转
System.out.println("由大到小排序:" + pokerList);
}
时间: 2024-12-16 12:25:01