Created
March 2, 2019 08:21
-
-
Save entrofi/bf0483748c525058370575e7c8ef3332 to your computer and use it in GitHub Desktop.
Java 8 Method References
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment