chore: Avoid copy the whole iterable for mapconcat and statefulMapConcat in javadsl. (#1250)
This commit is contained in:
parent
24e47b8cac
commit
f39ab64439
1 changed files with 2 additions and 4 deletions
|
|
@ -744,9 +744,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr
|
|||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def mapConcat[T](f: function.Function[Out, java.lang.Iterable[T]]): javadsl.Flow[In, T, Mat] =
|
||||
new Flow(delegate.mapConcat { elem =>
|
||||
Util.immutableSeq(f(elem))
|
||||
})
|
||||
new Flow(delegate.mapConcat(f(_).asScala))
|
||||
|
||||
/**
|
||||
* Transform each stream element with the help of a state.
|
||||
|
|
@ -900,7 +898,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr
|
|||
f: function.Creator[function.Function[Out, java.lang.Iterable[T]]]): javadsl.Flow[In, T, Mat] =
|
||||
new Flow(delegate.statefulMapConcat { () =>
|
||||
val fun = f.create()
|
||||
elem => Util.immutableSeq(fun(elem))
|
||||
elem => fun(elem).asScala
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue