zipWith
Combines elements from multiple sources through a combine
function and passes the returned value downstream.
Signature
Description
Combines elements from multiple sources through a combine
function and passes the returned value downstream.
See also:
Examples
- Scala
-
source
import akka.stream.scaladsl.Source import akka.stream.scaladsl.Sink val sourceCount = Source(List("one", "two", "three")) val sourceFruits = Source(List("apple", "orange", "banana")) sourceCount .zipWith(sourceFruits) { (countStr, fruitName) => s"$countStr $fruitName" } .runWith(Sink.foreach(println)) // this will print 'one apple', 'two orange', 'three banana'
- Java
Reactive Streams semantics
emits when all of the inputs have an element available
backpressures both upstreams when downstream backpressures but also on an upstream that has emitted an element until the other upstream has emitted an element
completes when any upstream completes