Created
January 24, 2018 08:35
-
-
Save zacker330/c22f2960556f88b5c150b6d9e177a316 to your computer and use it in GitHub Desktop.
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 static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { | |
Set<Object> seen = ConcurrentHashMap.newKeySet(); | |
return t -> seen.add(keyExtractor.apply(t)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment