Sink.collect
Collect all input elements using a Java Collector
.
Signature
Description
A Sink
which materializes into a CompletionStage
which will be completed with a result of the Java Collector
transformation and reduction operations.
Example
Given a stream of numbers we can collect the numbers into a collection with the seq
operator
- Java
-
source
final List<Integer> list = Arrays.asList(1, 2, 3); CompletionStage<List<Integer>> result = Source.from(list).runWith(Sink.collect(Collectors.toList()), system);
Reactive Streams semantics
1.0.1