升序
Collections.sort(list, new Comparator<T>() {
@Override
public int compare(T o1,
T o2) {
return o1.getXxx().compareTo(o2.getXxx());
}
});
降序
Collections.sort(list, Collections.reverseOrder(new Comparator<T>() {
@Override
public int compare(T o1,
T o2) {
return o1.getXxx().compareTo(o2.getXxx());
}
}));