Created
November 13, 2018 11:40
-
-
Save hudsonmendes/aea8f24d78c9c8a94a022021c25fa06c to your computer and use it in GitHub Desktop.
Sort using Lambdas
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
public class OrderingServiceImpl implements OrderingService { | |
@Override | |
public List<SearchResult> orderWithComparator(List<SearchResult>) { | |
return results | |
.stream() | |
.distinct() | |
.sorted((a, b) -> r.getName().compareTo(b.getName())) | |
.collect(toList()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment