共用方式為


Collectors.Teeing(ICollector, ICollector, IBiFunction) Method

Definition

Returns a Collector that is a composite of two downstream collectors.

[Android.Runtime.Register("teeing", "(Ljava/util/stream/Collector;Ljava/util/stream/Collector;Ljava/util/function/BiFunction;)Ljava/util/stream/Collector;", "", ApiSince=35)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "R1", "R2", "R" })]
public static Java.Util.Streams.ICollector? Teeing (Java.Util.Streams.ICollector? downstream1, Java.Util.Streams.ICollector? downstream2, Java.Util.Functions.IBiFunction? merger);
[<Android.Runtime.Register("teeing", "(Ljava/util/stream/Collector;Ljava/util/stream/Collector;Ljava/util/function/BiFunction;)Ljava/util/stream/Collector;", "", ApiSince=35)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "R1", "R2", "R" })>]
static member Teeing : Java.Util.Streams.ICollector * Java.Util.Streams.ICollector * Java.Util.Functions.IBiFunction -> Java.Util.Streams.ICollector

Parameters

downstream1
ICollector

the first downstream collector

downstream2
ICollector

the second downstream collector

merger
IBiFunction

the function which merges two results into the single one

Returns

a Collector which aggregates the results of two supplied collectors.

Attributes

Remarks

Returns a Collector that is a composite of two downstream collectors. Every element passed to the resulting collector is processed by both downstream collectors, then their results are merged using the specified merge function into the final result.

The resulting collector functions do the following:

<ul> <li>supplier: creates a result container that contains result containers obtained by calling each collector's supplier <li>accumulator: calls each collector's accumulator with its result container and the input element <li>combiner: calls each collector's combiner with two result containers <li>finisher: calls each collector's finisher with its result container, then calls the supplied merger and returns its result. </ul>

The resulting collector is Collector.Characteristics#UNORDERED if both downstream collectors are unordered and Collector.Characteristics#CONCURRENT if both downstream collectors are concurrent.

Added in 12.

Java documentation for java.util.stream.Collectors.teeing(java.util.stream.Collector<? super T, ?, R1>, java.util.stream.Collector<? super T, ?, R2>, java.util.function.BiFunction<? super R1, ? super R2, R>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to