1.
public void compareList(final List resultList) { Collections.sort(resultList, new Comparator<Map>() { @Override public int compare(Map o1, Map o2) { Date date1 = null; Date date2 = null; DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); if (o1.get("DUE_TIME") != null && o2.get("DUE_TIME") != null) { try { date1 = fmt.parse(String.valueOf(o1.get("DUE_TIME"))); date2 = fmt.parse(String.valueOf(o2.get("DUE_TIME"))); } catch (ParseException e) { e.printStackTrace(); } if (date1.getTime() > date2.getTime()) { return 1; } if (date2.getTime() > date1.getTime()) { return 0; } return 1; } return 0; } }); }
时间: 2024-10-31 11:06:52