Sắp xếp tăng dần trong arraylist

answer

Phan Kiết Trinh · Phan Kiết Trinh 12:50 27/04/2013

Collections.sort[testList]; Collections.reverse[testList];

Điều đó sẽ làm những gì bạn muốn. Nhớ nhập Collectionsdù!

Đây là tài liệu choCollections .

474 hữu ích 5 bình luận chia sẻ

answer

Dương Diễm Phước · Dương Diễm Phước 01:59 07/01/2016

Giảm dần:

Collections.sort[mArrayList, new Comparator[] { @Override public int compare[CustomData lhs, CustomData rhs] { // -1 - less than, 1 - greater than, 0 - equal, all inversed for descending return lhs.customInt > rhs.customInt ? -1 : [lhs.customInt

Chủ Đề