list
.stream().sorted((o1
, o2
) -> {
SimpleDateFormat format
= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date dt1
= format
.parse(o1
.getRecordTime());
Date dt2
= format
.parse(o2
.getRecordTime());
return Long
.compare(dt2
.getTime(), dt1
.getTime());
} catch (Exception e
) {
e
.printStackTrace();
}
return 0;
}).collect(Collectors
.toList());
转载请注明原文地址:https://tech.qufami.com/read-28427.html