Add combinedMat method to Source (#23809)

* Add combinedMat method to Source

* Fix formatting
This commit is contained in:
Richard Imaoka 2017-11-02 10:34:40 +09:00 committed by Konrad `ktoso` Malawski
parent 0988933fac
commit a50df1c575
4 changed files with 87 additions and 0 deletions

View file

@ -317,6 +317,15 @@ object Source {
new Source(scaladsl.Source.combine(first.asScala, second.asScala, seq: _*)(num strategy.apply(num)))
}
/**
* Combines two sources with fan-in strategy like `Merge` or `Concat` and returns `Source` with a materialized value.
*/
def combineMat[T, U, M1, M2, M](first: Source[T, M1], second: Source[T, M2],
strategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]],
combine: function.Function2[M1, M2, M]): Source[U, M] = {
new Source(scaladsl.Source.combineMat(first.asScala, second.asScala)(num strategy.apply(num))(combinerToScala(combine)))
}
/**
* Combine the elements of multiple streams into a stream of lists.
*/