2019-02-13 JAVA 8 LAMBDA 给对象排序
2019-02-13 本文已影响8人
Albert陈凯
正序
collection.stream().sorted(Comparator.comparing(MyClass::getProp));
倒序 desc
collection.stream().sorted(Comparator.comparing(MyClass::getProp)).reversed();
collection.stream().sorted(Comparator.comparing(MyClass::getProp));
collection.stream().sorted(Comparator.comparing(MyClass::getProp)).reversed();