接口的使用
java.util.function.ToIntFunction
使用 ToIntFunction 的包
包
描述
包含集合框架、一些国际化支持类、服务加载器、属性、随机数生成、字符串解析和扫描类、base64 编码和解码、位数组和几个杂项实用程序类。
通常在并发编程中有用的实用程序类。
支持对元素流进行函数式操作的类,例如对集合的 map-reduce 转换。
-
ToIntFunction 在 java.util 中的用法
java.util 中的方法,参数类型为 ToIntFunction修饰符和类型方法描述static <T> Comparator<T>Comparator.comparingInt(ToIntFunction<? super T> keyExtractor) 接受一个函数,该函数从类型T中提取int排序键,并返回与该排序键进行比较的Comparator<T>。default Comparator<T>Comparator.thenComparingInt(ToIntFunction<? super T> keyExtractor) 返回具有提取int排序键的函数的词典顺序比较器。 -
ToIntFunction 在 java.util.concurrent 中的用法
java.util.concurrent 中的方法,参数类型为 ToIntFunction修饰符和类型方法描述intConcurrentHashMap.reduceEntriesToInt(long parallelismThreshold, ToIntFunction<Map.Entry<K, V>> transformer, int basis, IntBinaryOperator reducer) 返回使用给定的 reducer 组合值的所有条目的给定转换的累加结果,并将给定的基础作为标识值。intConcurrentHashMap.reduceKeysToInt(long parallelismThreshold, ToIntFunction<? super K> transformer, int basis, IntBinaryOperator reducer) 返回使用给定的 reducer 将所有键的给定转换累积起来以组合值的结果,并将给定的基作为标识值。intConcurrentHashMap.reduceValuesToInt(long parallelismThreshold, ToIntFunction<? super V> transformer, int basis, IntBinaryOperator reducer) 返回使用给定的 reducer 将所有值的给定转换累积起来以组合值的结果,并将给定的基础作为标识值。 -
ToIntFunction 在 java.util.stream 中的用法
java.util.stream 中的方法,参数类型为 ToIntFunction修饰符和类型方法描述Collectors.averagingInt(ToIntFunction<? super T> mapper) 返回一个Collector,它产生应用于输入元素的整数值函数的算术平均值。Stream.mapToInt(ToIntFunction<? super T> mapper) 返回一个IntStream,由将给定函数应用于此流的元素的结果组成。static <T> Collector<T,?, IntSummaryStatistics> Collectors.summarizingInt(ToIntFunction<? super T> mapper) 返回一个Collector,它将int生成映射函数应用于每个输入元素,并返回结果值的汇总统计信息。Collectors.summingInt(ToIntFunction<? super T> mapper) 返回一个Collector,它产生应用于输入元素的整数值函数的总和。