how to sort an ArrayList in ascending order using Collections and Comparator

后端 未结 6 796
轮回少年
轮回少年 2020-12-06 07:36

How to sort an ArrayList in ascending order using Comparator? I know how to sort it in descending order using:

Comparator mycompar         


        
6条回答
  •  时光说笑
    2020-12-06 08:31

    This might work?

    Comparator mycomparator = 
        Collections.reverseOrder(Collections.reverseOrder());
    

提交回复
热议问题