自Java 8以来,列单接口提供排序方法。结合兰卜达表达式最简单的解决方案是// sort DateTime typed listlist.sort((d1,d2) -> d1.compareTo(d2));// or an object which has an DateTime attributelist.sort((o1,o2) -> o1.getDateTime().compareTo(o2.getDateTime()));// or like mentioned by Tunakilist.sort(Comparator.comparing(o -> o.getDateTime()))