Sorting of ArrayList

后端 未结 5 2262
渐次进展
渐次进展 2020-12-10 22:24

I have one array list

ArrayList itemListWithRank = ItemListDAO.getItemList();

and in arraylist itemListWithRank there are lot

5条回答
  •  攒了一身酷
    2020-12-10 23:02

    Collections.sort(itemListWithRank ,new Comparator() {
    
        public int compare(Person o1, Person o2) {
            return Integer.valueOf(o1.id).compareTo(Integer.valueOf(o2.id));
        }
    });
    

提交回复
热议问题