- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Comparator;
- import java.util.Iterator;
- public class Deno11 {
- public static void main(String[] args) {
- ArrayList<Integer> al=new ArrayList<>();
- al.add(22);
- al.add(10);
- al.add(2);
- al.add(5);
- Sort2.shengxuSort(al);
- System.out.println(al);
- Sort2.jiangxuSort(al);
- System.out.println(al);
- }
- }
- class Sort2{
- public static void shengxuSort(ArrayList al){
- Collections.sort(al);
- }
- public static void jiangxuSort(ArrayList al){
- Collections.reverseOrder();
- }
- }
- 不知道哪里出了错,两次的输出结果顺序是一样的,蒙圈了
|
|