跳至内容
- Collectors收集器,提供了大量的静态方法对流进行操作
- 单一求值
- 求和
- summingDouble(ToDoubleFunction<? super T> mapper)
- summingInt(ToIntFunction<? super T> mapper)
- summingLong(ToLongFunction<? super T> mapper)
- 求数量
- 求平均
- averagingDouble(ToDoubleFunction<? super T> mapper)
- averagingInt(ToIntFunction<? super T> mapper)
- averagingLong(ToLongFunction<? super T> mapper)
- 求最大值
- maxBy(Comparator<? super T> comparator)
- 求最小值
- minBy(Comparator<? super T> comparator)
- 求值工厂:一次性求和、求数量、求平均、最大、最小值
- summarizingDouble(ToDoubleFunction<? super T> mapper)
- summarizingInt(ToIntFunction<? super T> mapper)
- summarizingLong(ToLongFunction<? super T> mapper)
- 拼接
- 分组
- groupingBy(Function<? super T,? extends K> classifier)
- 分区
- partitioningBy(Predicate<? super T> predicate)
- 规约
- reducing(BinaryOperator op)
- 映射
- toCollection(Supplier collectionFactory)
- toConcurrentMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper)
- toList()
- toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper)
- toSet()
- mapping(Function<? super T,? extends U> mapper, Collector<? super U,A,R> downstream)