Uses of Interface
java.util.function.Function
-
Packages that use Function 软件包 描述 java.lang 提供对Java编程语言设计至关重要的类。java.net.http HTTP客户端和WebSocket APIjava.security 提供安全框架的类和接口。java.util 包含集合框架,一些国际化支持类,服务加载器,属性,随机数生成,字符串解析和扫描类,base64编码和解码,位数组和几个其他实用程序类。java.util.concurrent 实用类通常在并发编程中有用。java.util.function 功能接口为lambda表达式和方法引用提供目标类型。java.util.logging 提供Javaâ“2平台核心日志记录工具的类和接口。java.util.regex 用于将字符序列与正则表达式指定的模式匹配的类。java.util.stream 用于支持元素流上的功能样式操作的类,例如集合上的map-reduce转换。jdk.jshell 提供用于创建工具的接口,例如读取 - 评估 - 打印循环(REPL),其交互式地评估Java编程语言代码的“片段”。 -
-
Uses of Function in java.lang
Methods in java.lang with parameters of type Function 变量和类型 方法 描述 ModuleLayerModuleLayer. defineModules(Configuration cf, Function<String,ClassLoader> clf)通过将给定Configuration的模块定义到Java虚拟机,创建一个新模块层,将该层作为其父层。static ModuleLayer.ControllerModuleLayer. defineModules(Configuration cf, List<ModuleLayer> parentLayers, Function<String,ClassLoader> clf)通过将给定Configuration的模块定义到Java虚拟机来创建新模块层。<T> TStackWalker. walk(Function<? super Stream<StackWalker.StackFrame>,? extends T> function)将给定函数应用于当前线程的StackFrames流,从堆栈的顶部框架遍历,这是调用此walk方法的方法。 -
Uses of Function in java.net.http
Methods in java.net.http with parameters of type Function 变量和类型 方法 描述 voidHttpResponse.PushPromiseHandler. applyPushPromise(HttpRequest initiatingRequest, HttpRequest pushPromiseRequest, Function<HttpResponse.BodyHandler<T>,CompletableFuture<HttpResponse<T>>> acceptor)传入推送承诺的通知。static <S extends Flow.Subscriber<? super String>,T>
HttpResponse.BodyHandler<T>HttpResponse.BodyHandlers. fromLineSubscriber(S subscriber, Function<? super S,? extends T> finisher, String lineSeparator)返回响应身体处理程序返回一个BodySubscriber<T>从获得的BodySubscribers.fromLineSubscriber(subscriber, finisher, charset, lineSeparator),用给定的subscriber,finisher功能,和在线分离器。static <S extends Flow.Subscriber<? super String>,T>
HttpResponse.BodySubscriber<T>HttpResponse.BodySubscribers. fromLineSubscriber(S subscriber, Function<? super S,? extends T> finisher, Charset charset, String lineSeparator)返回一个主体订阅者,它将所有响应主体Flow.Subscriber转发给给定的Flow.Subscriber。static <S extends Flow.Subscriber<? super List<ByteBuffer>>,T>
HttpResponse.BodyHandler<T>HttpResponse.BodyHandlers. fromSubscriber(S subscriber, Function<? super S,? extends T> finisher)返回一个响应体处理程序,它返回BodySubscriber<T>,从HttpResponse.BodySubscribers.fromSubscriber(Subscriber, Function)获得,具有给定的subscriber和finisher函数。static <S extends Flow.Subscriber<? super List<ByteBuffer>>,T>
HttpResponse.BodySubscriber<T>HttpResponse.BodySubscribers. fromSubscriber(S subscriber, Function<? super S,? extends T> finisher)返回一个主体订阅者,它将所有响应主体转发给给定的Flow.Subscriber。static <T,U>
HttpResponse.BodySubscriber<U>HttpResponse.BodySubscribers. mapping(HttpResponse.BodySubscriber<T> upstream, Function<? super T,? extends U> mapper)返回BodySubscriber其响应正文值是将给定函数应用于给定upstreamBodySubscriber的正文对象的upstreamBodySubscriber。static <T> HttpResponse.PushPromiseHandler<T>HttpResponse.PushPromiseHandler. of(Function<HttpRequest,HttpResponse.BodyHandler<T>> pushPromiseHandler, ConcurrentMap<HttpRequest,CompletableFuture<HttpResponse<T>>> pushPromisesMap)返回推送承诺处理程序,它将推送承诺及其响应累积到给定的映射中。 -
Uses of Function in java.security
Methods in java.security with parameters of type Function 变量和类型 方法 描述 ObjectProvider. computeIfAbsent(Object key, Function<? super Object,? extends Object> mappingFunction)如果指定的键尚未与值关联(或映射到null),则尝试使用给定的映射函数计算其值并将其输入此映射,除非null。 -
Uses of Function in java.util
Methods in java.util with parameters of type Function 变量和类型 方法 描述 static <T,U extends Comparable<? super U>>
Comparator<T>Comparator. comparing(Function<? super T,? extends U> keyExtractor)接受从类型T中提取Comparable排序键的T,并返回按该排序键进行比较的Comparator<T>。static <T,U>
Comparator<T>Comparator. comparing(Function<? super T,? extends U> keyExtractor, Comparator<? super U> keyComparator)接受从类型T中提取排序键的T,并返回Comparator<T>,使用指定的Comparator按该排序键进行比较。VHashMap. computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)如果指定的键尚未与值关联(或映射到null),则尝试使用给定的映射函数计算其值并将其输入此映射,除非null。VHashtable. computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)如果指定的键尚未与值关联(或映射到null),则尝试使用给定的映射函数计算其值并将其输入此映射,除非null。default VMap. computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)如果指定的键尚未与值关联(或映射到null),则尝试使用给定的映射函数计算其值并将其输入此映射,除非null。<U> Optional<U>Optional. flatMap(Function<? super T,? extends Optional<? extends U>> mapper)如果存在值,则返回将给定的Optionalmapping函数应用于该值的结果,否则返回空Optional。<U> Optional<U>Optional. map(Function<? super T,? extends U> mapper)default <U extends Comparable<? super U>>
Comparator<T>Comparator. thenComparing(Function<? super T,? extends U> keyExtractor)返回一个字典顺序比较器,其中包含一个提取Comparable排序键的函数。default <U> Comparator<T>Comparator. thenComparing(Function<? super T,? extends U> keyExtractor, Comparator<? super U> keyComparator)返回一个字典顺序比较器,其中包含一个函数,用于提取要与给定Comparator进行比较的键。 -
Uses of Function in java.util.concurrent
Methods in java.util.concurrent with parameters of type Function 变量和类型 方法 描述 <U> CompletionStage<U>CompletionStage. applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn)返回一个新的CompletionStage,当这个或另一个给定的阶段正常完成时,将执行相应的结果作为所提供函数的参数。<U> CompletionStage<U>CompletionStage. applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn)返回一个新的CompletionStage,当该阶段或其他给定阶段正常完成时,使用此阶段的默认异步执行工具执行,并将相应的结果作为所提供函数的参数。<U> CompletionStage<U>CompletionStage. applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)返回一个新的CompletionStage,当这个或另一个给定阶段正常完成时,使用提供的执行程序执行,并将相应的结果作为所提供函数的参数。VConcurrentHashMap. computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)如果指定的键尚未与值关联,则尝试使用给定的映射函数计算其值,并将其输入此映射,除非null。default VConcurrentMap. computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)如果指定的键尚未与值关联(或映射到null),则尝试使用给定的映射函数计算其值并将其输入此映射,除非null。VConcurrentSkipListMap. computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)如果指定的键尚未与值关联,则尝试使用给定的映射函数计算其值,并将其输入此映射,除非null。CompletableFuture<T>CompletableFuture. exceptionally(Function<Throwable,? extends T> fn)返回一个新的CompletableFuture,该CompletableFuture在此CompletableFuture完成时完成,异常的给定函数的结果在异常完成时触发此CompletableFuture的完成; 否则,如果此CompletableFuture正常完成,则返回的CompletableFuture也会以相同的值正常完成。CompletionStage<T>CompletionStage. exceptionally(Function<Throwable,? extends T> fn)返回一个新的CompletionStage,当该阶段异常完成时,将以此阶段的异常作为所提供函数的参数执行。<U> voidConcurrentHashMap. forEachEntry(long parallelismThreshold, Function<Map.Entry<K,V>,? extends U> transformer, Consumer<? super U> action)对每个条目的每个非null转换执行给定操作。<U> voidConcurrentHashMap. forEachKey(long parallelismThreshold, Function<? super K,? extends U> transformer, Consumer<? super U> action)对每个键的每个非空转换执行给定的操作。<U> voidConcurrentHashMap. forEachValue(long parallelismThreshold, Function<? super V,? extends U> transformer, Consumer<? super U> action)对每个值的每个非null转换执行给定的操作。<U> UConcurrentHashMap. reduceEntries(long parallelismThreshold, Function<Map.Entry<K,V>,? extends U> transformer, BiFunction<? super U,? super U,? extends U> reducer)返回使用给定的reducer汇总所有条目的给定转换以组合值的结果,如果没有则返回null。<U> UConcurrentHashMap. reduceKeys(long parallelismThreshold, Function<? super K,? extends U> transformer, BiFunction<? super U,? super U,? extends U> reducer)返回使用给定的reducer汇总所有键的给定转换以组合值的结果,如果没有则返回null。<U> UConcurrentHashMap. reduceValues(long parallelismThreshold, Function<? super V,? extends U> transformer, BiFunction<? super U,? super U,? extends U> reducer)返回使用给定的reducer汇总所有值的给定转换以组合值的结果,如果没有则返回null。<U> UConcurrentHashMap. searchEntries(long parallelismThreshold, Function<Map.Entry<K,V>,? extends U> searchFunction)返回在每个条目上应用给定搜索函数的非null结果,如果没有则返回null。<U> UConcurrentHashMap. searchKeys(long parallelismThreshold, Function<? super K,? extends U> searchFunction)返回在每个键上应用给定搜索函数的非null结果,如果没有则返回null。<U> UConcurrentHashMap. searchValues(long parallelismThreshold, Function<? super V,? extends U> searchFunction)返回在每个值上应用给定搜索函数的非null结果,如果没有则返回null。<U> CompletionStage<U>CompletionStage. thenApply(Function<? super T,? extends U> fn)返回一个新的CompletionStage,当该阶段正常完成时,将使用此阶段的结果作为所提供函数的参数执行。<U> CompletionStage<U>CompletionStage. thenApplyAsync(Function<? super T,? extends U> fn)返回一个新的CompletionStage,当该阶段正常完成时,使用此阶段的默认异步执行工具执行,该阶段的结果作为所提供函数的参数。<U> CompletionStage<U>CompletionStage. thenApplyAsync(Function<? super T,? extends U> fn, Executor executor)返回一个新的CompletionStage,当这个阶段正常完成时,使用提供的Executor执行,该阶段的结果作为所提供函数的参数。<U> CompletionStage<U>CompletionStage. thenCompose(Function<? super T,? extends CompletionStage<U>> fn)返回一个新的CompletionStage,它完成的值与给定函数返回的CompletionStage相同。<U> CompletionStage<U>CompletionStage. thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn)返回一个新的CompletionStage,它使用与给定函数返回的CompletionStage相同的值完成,使用此阶段的默认异步执行工具执行。<U> CompletionStage<U>CompletionStage. thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)返回一个新的CompletionStage,它使用与给定函数返回的CompletionStage相同的值完成,使用提供的Executor执行。 -
Uses of Function in java.util.function
Subinterfaces of Function in java.util.function 变量和类型 接口 描述 interfaceUnaryOperator<T>表示对单个操作数的操作,该操作生成与其操作数相同类型的结果。Methods in java.util.function that return Function 变量和类型 方法 描述 default <V> Function<T,V>Function. andThen(Function<? super R,? extends V> after)返回首先将此函数应用于其输入的after函数,然后将after函数应用于结果。default <V> Function<V,R>Function. compose(Function<? super V,? extends T> before)返回一个组合函数,该函数首先将before函数应用于其输入,然后将此函数应用于结果。static <T> Function<T,T>Function. identity()返回一个始终返回其输入参数的函数。Methods in java.util.function with parameters of type Function 变量和类型 方法 描述 default <V> BiFunction<T,U,V>BiFunction. andThen(Function<? super R,? extends V> after)返回首先将此函数应用于其输入的after函数,然后将after函数应用于结果。default <V> Function<T,V>Function. andThen(Function<? super R,? extends V> after)返回首先将此函数应用于其输入的after函数,然后将after函数应用于结果。default <V> Function<V,R>Function. compose(Function<? super V,? extends T> before)返回首先将before函数应用于其输入的before函数,然后将此函数应用于结果。 -
Uses of Function in java.util.logging
Methods in java.util.logging with parameters of type Function 变量和类型 方法 描述 voidLogManager. updateConfiguration(InputStream ins, Function<String,BiFunction<String,String,String>> mapper)更新日志记录配置。voidLogManager. updateConfiguration(Function<String,BiFunction<String,String,String>> mapper)更新日志记录配置。 -
Uses of Function in java.util.regex
Methods in java.util.regex with parameters of type Function 变量和类型 方法 描述 StringMatcher. replaceAll(Function<MatchResult,String> replacer)将与模式匹配的输入序列的每个子序列替换为将给定的替换函数应用于与该子序列对应的此匹配器的匹配结果的结果。StringMatcher. replaceFirst(Function<MatchResult,String> replacer)将与模式匹配的输入序列的第一个子序列替换为将给定的replacer函数应用于与该子序列对应的此匹配器的匹配结果的结果。 -
Uses of Function in java.util.stream
Methods in java.util.stream that return Function 变量和类型 方法 描述 Function<A,R>Collector. finisher()执行从中间累积类型A到最终结果类型R的最终R。Methods in java.util.stream with parameters of type Function 变量和类型 方法 描述 static <T,A,R,RR>
Collector<T,A,RR>Collectors. collectingAndThen(Collector<T,A,R> downstream, Function<R,RR> finisher)Collector以执行额外的精加工转换。<R> Stream<R>Stream. flatMap(Function<? super T,? extends Stream<? extends R>> mapper)返回一个流,该流包含将此流的每个元素替换为通过将提供的映射函数应用于每个元素而生成的映射流的内容的结果。static <T,U,A,R>
Collector<T,?,R>Collectors. flatMapping(Function<? super T,? extends Stream<? extends U>> mapper, Collector<? super U,A,R> downstream)通过在累积之前对每个输入元素应用平面映射函数,将Collector类型Collector接受元素U为一个接受T类型的元素。DoubleStreamStream. flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)返回DoubleStream其中包含将此流的每个元素替换为通过将提供的映射函数应用于每个元素而生成的映射流的内容的结果。IntStreamStream. flatMapToInt(Function<? super T,? extends IntStream> mapper)返回IntStream其中包含将此流的每个元素替换为通过将提供的映射函数应用于每个元素而生成的映射流的内容的结果。LongStreamStream. flatMapToLong(Function<? super T,? extends LongStream> mapper)返回LongStream其中包含将此流的每个元素替换为通过将提供的映射函数应用于每个元素而生成的映射流的内容的结果。static <T,K>
Collector<T,?,Map<K,List<T>>>Collectors. groupingBy(Function<? super T,? extends K> classifier)返回Collector“由基团”上的类型的输入元件操作实现T,根据分类功能分组元素,并且在返回的结果Map。static <T,K,D,A,M extends Map<K,D>>
Collector<T,?,M>Collectors. groupingBy(Function<? super T,? extends K> classifier, Supplier<M> mapFactory, Collector<? super T,A,D> downstream)返回Collector“由基团”上的类型的输入元件操作实现级联T,根据分类功能分组元素,然后使用下游的指定与给定键相关联的值进行还原操作Collector。static <T,K,A,D>
Collector<T,?,Map<K,D>>Collectors. groupingBy(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream)返回Collector“由基团”上的类型的输入元件操作实现级联T,根据分类功能分组元素,然后使用下游的指定与给定键相关联的值进行还原操作Collector。static <T,K>
Collector<T,?,ConcurrentMap<K,List<T>>>Collectors. groupingByConcurrent(Function<? super T,? extends K> classifier)返回并发Collector,对T类型的输入元素执行“分组依据”操作,根据分类函数对元素进行分组。static <T,K,A,D,M extends ConcurrentMap<K,D>>
Collector<T,?,M>Collectors. groupingByConcurrent(Function<? super T,? extends K> classifier, Supplier<M> mapFactory, Collector<? super T,A,D> downstream)返回并发Collector,对类型为T输入元素执行级联“分组依据”操作,根据分类函数对元素进行分组,然后使用指定的下游Collector对与给定键关联的值执行缩减操作。static <T,K,A,D>
Collector<T,?,ConcurrentMap<K,D>>Collectors. groupingByConcurrent(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream)返回并发Collector,对类型为T输入元素执行级联“分组依据”操作,根据分类函数对元素进行分组,然后使用指定的下游Collector对与给定键关联的值执行缩减操作。<R> Stream<R>Stream. map(Function<? super T,? extends R> mapper)返回一个流,该流包含将给定函数应用于此流的元素的结果。static <T,U,A,R>
Collector<T,?,R>Collectors. mapping(Function<? super T,? extends U> mapper, Collector<? super U,A,R> downstream)通过在累积之前将映射函数应用于每个输入元素,将T类型的Collector接受为U类型的接受元素。static <T,A,R>
Collector<T,A,R>Collector. of(Supplier<A> supplier, BiConsumer<A,T> accumulator, BinaryOperator<A> combiner, Function<A,R> finisher, Collector.Characteristics... characteristics)返回一个新Collector由给定的描述supplier,accumulator,combiner和finisher功能。static <T,U>
Collector<T,?,U>Collectors. reducing(U identity, Function<? super T,? extends U> mapper, BinaryOperator<U> op)返回Collector,它在指定的映射函数和BinaryOperator下执行其输入元素的BinaryOperator。static <T,K,U>
Collector<T,?,ConcurrentMap<K,U>>Collectors. toConcurrentMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper)返回并发Collector,它将元素累积到ConcurrentMap其键和值是将提供的映射函数应用于输入元素的结果。static <T,K,U>
Collector<T,?,ConcurrentMap<K,U>>Collectors. toConcurrentMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction)返回并发Collector,它将元素累积到ConcurrentMap其键和值是将提供的映射函数应用于输入元素的结果。static <T,K,U,M extends ConcurrentMap<K,U>>
Collector<T,?,M>Collectors. toConcurrentMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction, Supplier<M> mapFactory)返回并发Collector,它将元素累积到ConcurrentMap其键和值是将提供的映射函数应用于输入元素的结果。static <T,K,U>
Collector<T,?,Map<K,U>>Collectors. toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper)返回Collector,它将元素累积到Map其键和值是将提供的映射函数应用于输入元素的结果。static <T,K,U>
Collector<T,?,Map<K,U>>Collectors. toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction)返回Collector,它将元素累积到Map其键和值是将提供的映射函数应用于输入元素的结果。static <T,K,U,M extends Map<K,U>>
Collector<T,?,M>Collectors. toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction, Supplier<M> mapFactory)返回Collector,它将元素累积到Map其键和值是将提供的映射函数应用于输入元素的结果。static <T,K,U>
Collector<T,?,Map<K,U>>Collectors. toUnmodifiableMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper)返回Collector,它将输入元素累积到 unmodifiable Map中 ,其键和值是将提供的映射函数应用于输入元素的结果。static <T,K,U>
Collector<T,?,Map<K,U>>Collectors. toUnmodifiableMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction)返回Collector,它将输入元素累积到 unmodifiable Map中 ,其键和值是将提供的映射函数应用于输入元素的结果。 -
Uses of Function in jdk.jshell
Methods in jdk.jshell with parameters of type Function 变量和类型 方法 描述 JShell.BuilderJShell.Builder. fileManager(Function<StandardJavaFileManager,StandardJavaFileManager> mapping)配置FileManager以供编译和源分析使用。
-