关于List排序

这里关于List的排序:

public class ZtListSortUtil {
public static List<ApocalypseZtProductRO> getListSort (List<ApocalypseZtProductRO> a){
Collections.sort(a, new Comparator<ApocalypseZtProductRO>() {
public int compare(ApocalypseZtProductRO arg0, ApocalypseZtProductRO arg1) {
int hits0 = arg0.getCount();
int hits1 = arg1.getCount();
if (hits1 < hits0) {
return 1;
} else if (hits1 == hits0) {
return 0;
} else {
return -1;
}
}
});
return a;
}
}
原文地址:https://www.cnblogs.com/April-Chou-HelloWorld/p/6635315.html