public static <T>Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor){
Map<Object,Boolean> seen = new ConcurrentHashMap<>();
return t -> seen.putIfAbsent(keyExtractor.apply(t),Boolean.TRUE) == null;
}
distinctByKey
最新推荐文章于 2023-12-22 11:23:25 发布