Akka 27103/streams zip all #27103
This commit is contained in:
parent
98865d7fb6
commit
14c02302bc
11 changed files with 355 additions and 5 deletions
|
|
@ -19,6 +19,7 @@ import org.reactivestreams.{ Publisher, Subscriber }
|
|||
|
||||
import scala.annotation.unchecked.uncheckedVariance
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
|
||||
import scala.collection.immutable
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
import scala.concurrent.{ Future, Promise }
|
||||
|
|
@ -1153,6 +1154,37 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out @uncheckedVariance Pair T, M2] =
|
||||
this.viaMat(Flow.create[Out].zipMat(that, Keep.right[NotUsed, M]), matF)
|
||||
|
||||
/**
|
||||
* Combine the elements of current flow and the given [[Source]] into a stream of tuples.
|
||||
*
|
||||
* '''Emits when''' 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 when''' downstream backpressures
|
||||
*
|
||||
* '''Completes when''' all upstream completes
|
||||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def zipAll[U, A >: Out](that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): Source[Pair[A, U], Mat] =
|
||||
new Source(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) })
|
||||
|
||||
/**
|
||||
* Combine the elements of current flow and the given [[Source]] into a stream of tuples.
|
||||
*
|
||||
* @see [[#zipAll]]
|
||||
*
|
||||
* '''Emits when''' 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 when''' downstream backpressures
|
||||
*
|
||||
* '''Completes when''' all upstream completes
|
||||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def zipAllMat[U, Mat2, Mat3, A >: Out](that: Graph[SourceShape[U], Mat2], thisElem: A, thatElem: U)(
|
||||
matF: (Mat, Mat2) => Mat3): Source[Pair[A, U], Mat3] =
|
||||
new Source(delegate.zipAllMat(that, thisElem, thatElem)(matF).map { case (a, u) => Pair.create(a, u) })
|
||||
|
||||
/**
|
||||
* Combine the elements of 2 streams into a stream of tuples, picking always the latest element of each.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue