long t = list.stream().filter(distinctByKey(e -> e.getDate())).count();publicstatic<T>Predicate<T>distinctByKey(Function<?superT,?> keyExtractor){Map<Object,Boolean> seen =newConcurrentHashMap<>();return t -> seen.putIfAbsent(keyExtractor.apply(t),Boolean.TRUE)==null;}
java8 stream 应用最大最小List<Integer> list=Arrays.asList(8,2,5,4);Optional<Integer> max = list.stream().max(Comparator.comparingInt(Integer::intValue));Optional<Integer> min = list.st...