You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2024/04/05 15:54:04 UTC

(pekko) branch main updated: chore: Avoid copy the whole iterable for mapconcat and statefulMapConcat in javadsl. (#1250)

This is an automated email from the ASF dual-hosted git repository.

hepin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new f39ab64439 chore: Avoid copy the whole iterable for mapconcat and statefulMapConcat in javadsl. (#1250)
f39ab64439 is described below

commit f39ab64439a55ec7de9ab3d80b7a4e89901f0952
Author: He-Pin(kerr) <he...@gmail.com>
AuthorDate: Fri Apr 5 23:53:59 2024 +0800

    chore: Avoid copy the whole iterable for mapconcat and statefulMapConcat in javadsl. (#1250)
---
 stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
index aabb87b47a..fc4ea3e3b3 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
@@ -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
     })
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org