Closed danieldietrich closed 9 years ago
Unlike the implementation suggested here, it is not necessary to make the implementation concurrent because List
and Stream
aren't. That leads to
<U> Stream<T> distinct(Function<? super T, ? extends U> keyExtractor) {
final Set<U> seen = new HashSet<>();
return filter(t -> seen.add(keyExtractor.apply(t)));
}
See jOOQ/jOOL#82