zipAll
Combines elements from two sources into tuples handling early completion of either source.
Signature
Description
Combines elements from two sources into tuples and passes downstream. If either source completes, a default value is combined with each value from the other source until it completes.
See also:
Example
- Scala
-
source
val numbers = Source(1 :: 2 :: 3 :: 4 :: Nil) val letters = Source("a" :: "b" :: "c" :: Nil) numbers.zipAll(letters, -1, "default").runForeach(println) // prints: // (1,a) // (2,b) // (3,c) // (4,default)
- Java
Reactive Streams semantics
emits at first emits when both inputs emit, and then as long as any input emits (coupled to the default value of the completed input)
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 both upstream completes