entrofi
3/2/2019 - 8:21 AM

Java 8 Method References

Java 8 Method References

List<SomeComparableObject> objects = Arrays.asList( o1, o2, o3, ...);
ojbects.sort((SomeComparableObject o1, SomeComparableObject o2) -> o1.compareTo(o2)); // or with method reference
objects.sort(SomeComparableObject::compareTo);