list<T> 排序

Collections.sort(resultList, new Comparator<HashMap<String, Object>>() {
@Override
public int compare(HashMap<String, Object> o1, HashMap<String, Object> o2) {

Date time1 = (Date) o1.get("submit_time");
Date time2 = (Date) o2.get("submit_time");
if (null == time1) {
return -1;
}
if (null == time2) {
return 1;
}
return time1.compareTo(time2);
}
});

return ResultMessage.getSuccess().setData(resultList);
}
  

 

posted @ 2017-08-02 14:26  咸蛋超人、  阅读(128)  评论(0编辑  收藏  举报