Collections.sort 的日期排序
public static void main(String[] args) throws ParseException { // sort降序排列 List<Date> dates = new ArrayList<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dd = sdf.parse("2000-11-11 12:12:21"); Date aa = sdf.parse("2002-11-11 12:12:21"); Date date = new Date(); dates.add(date); dates.add(dd); dates.add(aa); Collections.sort(dates, new Comparator<Date>() { @Override public int compare(Date o1, Date o2) { int flag = o2.compareTo(o1); return flag; } }); System.out.println(dates.get(0)); }