1 用方法设置排序问题
public void sortCatList(List<O> list) {
Collections.sort(list, new Comparator<O>() {
@Override
public int compare(O o1, O o2) {
try {
if (o1 == null) {
return 1;
}
if (o2 == null) {
return -1;
}
long arg0 = o1.getSum();
long arg1 = o2.getSum();
if (arg0 < arg1) {
return 1;
} else if (arg0 == arg1) {
return 0;
} else {
return -1;
}
} catch (Exception ex) {
}
return 0;
}
});
}