根据list中对象的某个属性排序
Collections.sort(list, new Comparator() {
@Override
public int compare(QueryTemlateCloudDto o1, QueryTemlateCloudDto o2) {
try {
if (o1.getCreateTime().getTime() < o2.getCreateTime().getTime()) {
return 1;
} else if (o1.getCreateTime().getTime() > o2.getCreateTime().getTime()) {
return -1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
});