尝试这样的事情:
ArrayList<Date> dates = new ArrayList<>();
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateString1 = "2017-02-15";
String dateString2 = "2015-03-12";
String dateString3 = "2016-07-19";
Date date1 = null,date2=null,date3=null;
try {
date1 = sdf.parse(dateString1);
date2 = sdf.parse(dateString2);
date3 = sdf.parse(dateString3);
} catch (ParseException e) {
e.printStackTrace();
}
dates.add(date1);
dates.add(date2);
dates.add(date3);
Collections.sort(dates, new Comparator<Date>() {
public int compare(Date d1, Date d2) {
return d1.compareTo(d2);
}
});