Docs: Reduce operator (#29641)
Co-authored-by: Arnout Engelen <github@bzzt.net>
This commit is contained in:
parent
4d00f9a8e8
commit
a12867b8b1
3 changed files with 44 additions and 1 deletions
|
|
@ -456,6 +456,15 @@ class SourceOrFlow {
|
|||
// #dropWhile
|
||||
}
|
||||
|
||||
static void reduceExample() {
|
||||
// #reduceExample
|
||||
Source<Integer, NotUsed> source = Source.range(1, 100).reduce((acc, element) -> acc + element);
|
||||
CompletionStage<Integer> result = source.runWith(Sink.head(), system);
|
||||
result.thenAccept(System.out::println);
|
||||
// 5050
|
||||
// #reduceExample
|
||||
}
|
||||
|
||||
void watchExample() {
|
||||
// #watch
|
||||
final ActorRef ref = someActor();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue