private static void ListSort(List
//用Collections这个工具类传list进来排序
Collections.sort(list, new Comparator
@Override
public int compare(HdCase o1, HdCase o2) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
String str1=format.format(o1.getCreateDate());
String str2=format.format(o2.getCreateDate());
Date dt1 = format.parse(str1);
Date dt2 = format.parse(str2);
if (dt1.getTime() > dt2.getTime()) {
return 1;//小的放前面
}else {
return -1;
}
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
});
}