//按照某个字段去重 public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { Map<Object, Boolean> seen = new ConcurrentHashMap<>(); return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; }
List<IntegralCountVo> lists = list.stream().filter(distinctByKey(b -> b.getCompanyId())).collect(Collectors.toList());