Sort by comparable Bean property in Java 8
java
Solution
Yes, you could use method reference for this:
collection.stream().sorted(Comparator.comparing(MyClass::getProp));
Problem
Is there a shorter way to sort by a comparable property using Java 8 streams than this pattern? ``` collection.stream() .sorted((a,b) -> a.getProp().compareTo(b.getProp())) ```