Akka 27103/streams zip all #27103

This commit is contained in:
eyalfa 2019-07-05 17:40:06 +03:00 committed by Johan Andrén
parent 98865d7fb6
commit 14c02302bc
11 changed files with 355 additions and 5 deletions

View file

@ -6,12 +6,12 @@ package akka.stream.javadsl
import akka.NotUsed
import akka.event.LoggingAdapter
import akka.japi.{ function, Util }
import akka.japi.{ function, Pair, Util }
import akka.stream._
import akka.util.ConstantFun
import akka.util.JavaDurationConverters._
import akka.util.ccompat.JavaConverters._
import scala.annotation.unchecked.uncheckedVariance
import scala.concurrent.duration.FiniteDuration
import java.util.Comparator
@ -1521,6 +1521,23 @@ class SubSource[Out, Mat](
def zip[T](source: Graph[SourceShape[T], _]): SubSource[akka.japi.Pair[Out @uncheckedVariance, T], Mat] =
new SubSource(delegate.zip(source).map { case (o, t) => akka.japi.Pair.create(o, t) })
/**
* 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): SubSource[akka.japi.Pair[A, U], Mat] =
new SubSource(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, picking always the latest element of each.
*