How to sort an ArrayList?

后端 未结 20 2385
有刺的猬
有刺的猬 2020-11-22 06:19

I have a List of doubles in java and I want to sort ArrayList in descending order.

Input ArrayList is as below:

List testList = new Arr         


        
20条回答
  •  没有蜡笔的小新
    2020-11-22 06:44

    You can use like that

    ArrayList groupList = new ArrayList<>();
    Collections.sort(groupList, Collections.reverseOrder());
    Collections.reverse(groupList);
    

提交回复
热议问题