正序
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();
本文标题:2019-02-13 JAVA 8 LAMBDA 给对象排序
本文链接:https://www.haomeiwen.com/subject/dahdeqtx.html
网友评论