How to Sort an Arraylist of Date in ascending and descending order which is in String format

后端 未结 6 1718
轻奢々
轻奢々 2020-12-17 02:36

I have arrayLists of Dates which is in String format then how can I sort this arraylists,

ArrayList aryBeginDate;
ArrayList aryDu         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-17 03:14

    You can use a Comparator to sort the list. Something like this:

    Collections.sort(aryListBean, new Comparator() {
        @Override
        public int compare(RowItem r1, RowItem r2) {
            // Place your compare logic here
        }
    });
    

提交回复
热议问题