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

He-Pin pushed a commit to branch docs/scaladoc-list-of
in repository https://gitbox.apache.org/repos/asf/pekko.git

commit 13c9f078888dd515c4c661e0ff38f2f0dd63fb3f
Author: 虎鸣 <[email protected]>
AuthorDate: Tue Jun 23 09:33:06 2026 +0800

    docs: update Scaladoc examples from Arrays.asList to List.of
    
    Motivation:
    Scaladoc examples in the Stream Java DSL use Arrays.asList(...) which
    creates a mutable fixed-size list backed by an array.
    
    Modification:
    Replace with List.of(...) (JDK 9 factory) which returns a truly immutable
    list, consistent with modern Java best practices. Also updates the
    executable Graph.scala code where util.Arrays.asList was used.
    
    Result:
    Documentation examples use idiomatic JDK 9+ API.
    
    Tests:
    Not run - docs only (Scaladoc comments)
    
    References:
    Refs #3136
---
 .qoder/worktrees/deprecate-source-queue                           | 1 +
 .qoder/worktrees/revert-3063-broadcast-hub                        | 1 +
 stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala  | 8 ++++----
 stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala | 2 +-
 .../src/main/scala/org/apache/pekko/stream/javadsl/Source.scala   | 8 ++++----
 .../src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala  | 4 ++--
 .../main/scala/org/apache/pekko/stream/javadsl/SubSource.scala    | 6 +++---
 7 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/.qoder/worktrees/deprecate-source-queue 
b/.qoder/worktrees/deprecate-source-queue
new file mode 160000
index 0000000000..44e3d67c42
--- /dev/null
+++ b/.qoder/worktrees/deprecate-source-queue
@@ -0,0 +1 @@
+Subproject commit 44e3d67c4209935da834138c7647b8e1d812b861
diff --git a/.qoder/worktrees/revert-3063-broadcast-hub 
b/.qoder/worktrees/revert-3063-broadcast-hub
new file mode 160000
index 0000000000..203f8081f0
--- /dev/null
+++ b/.qoder/worktrees/revert-3063-broadcast-hub
@@ -0,0 +1 @@
+Subproject commit 203f8081f069eda71d8e449aa2407f0db30c4aab
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 5a889b6189..512b8ac022 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
@@ -1621,7 +1621,7 @@ final class Flow[In, Out, Mat](delegate: 
scaladsl.Flow[In, Out, Mat]) extends Gr
    * Examples:
    *
    * {{{
-   * Source<Integer, ?> nums = Source.from(Arrays.asList(0, 1, 2, 3));
+   * Source<Integer, ?> nums = Source.from(List.of(0, 1, 2, 3));
    * nums.intersperse(",");            //   1 , 2 , 3
    * nums.intersperse("[", ",", "]");  // [ 1 , 2 , 3 ]
    * }}}
@@ -1655,7 +1655,7 @@ final class Flow[In, Out, Mat](delegate: 
scaladsl.Flow[In, Out, Mat]) extends Gr
    * Examples:
    *
    * {{{
-   * Source<Integer, ?> nums = Source.from(Arrays.asList(0, 1, 2, 3));
+   * Source<Integer, ?> nums = Source.from(List.of(0, 1, 2, 3));
    * nums.intersperse(",");            //   1 , 2 , 3
    * nums.intersperse("[", ",", "]");  // [ 1 , 2 , 3 ]
    * }}}
@@ -3390,8 +3390,8 @@ final class Flow[In, Out, Mat](delegate: 
scaladsl.Flow[In, Out, Mat]) extends Gr
    *
    * Example:
    * {{{
-   * Source<Integer, ?> src = Source.from(Arrays.asList(1, 2, 3))
-   * Flow<Integer, Integer, ?> flow = 
flow.interleave(Source.from(Arrays.asList(4, 5, 6, 7)), 2)
+   * Source<Integer, ?> src = Source.from(List.of(1, 2, 3))
+   * Flow<Integer, Integer, ?> flow = flow.interleave(Source.from(List.of(4, 
5, 6, 7)), 2)
    * src.via(flow) // 1, 2, 4, 5, 3, 6, 7
    * }}}
    *
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala 
b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala
index ba9264a8b9..93ecadd84a 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala
@@ -726,7 +726,7 @@ object GraphDSL extends GraphCreate {
       : Graph[S, java.util.List[M]] = {
     require(!graphs.isEmpty, "The input list must have one or more Graph 
elements")
     val gbuilder = builder[java.util.List[M]]()
-    val toList = (m1: M) => new util.ArrayList(util.Arrays.asList(m1))
+    val toList = (m1: M) => new util.ArrayList(util.List.of(m1))
     val combine = (s: java.util.List[M], m2: M) => {
       val newList = new util.ArrayList(s)
       newList.add(m2)
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala 
b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
index e60a445e62..38e30a0a03 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
@@ -128,7 +128,7 @@ object Source {
    * Example usage:
    *
    * {{{
-   * Source.cycle(() -> Arrays.asList(1, 2, 3).iterator());
+   * Source.cycle(() -> List.of(1, 2, 3).iterator());
    * }}}
    *
    * Start a new 'cycled' `Source` from the given elements. The producer 
stream of elements
@@ -1514,7 +1514,7 @@ final class Source[Out, Mat](delegate: 
scaladsl.Source[Out, Mat]) extends Graph[
    *
    * Example:
    * {{{
-   * Source.from(Arrays.asList(1, 2, 
3)).interleave(Source.from(Arrays.asList(4, 5, 6, 7), 2)
+   * Source.from(List.of(1, 2, 3)).interleave(Source.from(List.of(4, 5, 6, 7), 
2)
    * // 1, 2, 4, 5, 3, 6, 7
    * }}}
    *
@@ -3504,7 +3504,7 @@ final class Source[Out, Mat](delegate: 
scaladsl.Source[Out, Mat]) extends Graph[
    * Examples:
    *
    * {{{
-   * Source<Integer, ?> nums = Source.from(Arrays.asList(0, 1, 2, 3));
+   * Source<Integer, ?> nums = Source.from(List.of(0, 1, 2, 3));
    * nums.intersperse(",");            //   1 , 2 , 3
    * nums.intersperse("[", ",", "]");  // [ 1 , 2 , 3 ]
    * }}}
@@ -3537,7 +3537,7 @@ final class Source[Out, Mat](delegate: 
scaladsl.Source[Out, Mat]) extends Graph[
    * Examples:
    *
    * {{{
-   * Source<Integer, ?> nums = Source.from(Arrays.asList(0, 1, 2, 3));
+   * Source<Integer, ?> nums = Source.from(List.of(0, 1, 2, 3));
    * nums.intersperse(",");            //   1 , 2 , 3
    * nums.intersperse("[", ",", "]");  // [ 1 , 2 , 3 ]
    * }}}
diff --git 
a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala 
b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala
index 0082bf73d5..e2a1644e12 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala
@@ -1013,7 +1013,7 @@ final class SubFlow[In, Out, Mat](
    * Examples:
    *
    * {{{
-   * Source<Integer, ?> nums = Source.from(Arrays.asList(0, 1, 2, 3));
+   * Source<Integer, ?> nums = Source.from(List.of(0, 1, 2, 3));
    * nums.intersperse(",");            //   1 , 2 , 3
    * nums.intersperse("[", ",", "]");  // [ 1 , 2 , 3 ]
    * }}}
@@ -1047,7 +1047,7 @@ final class SubFlow[In, Out, Mat](
    * Examples:
    *
    * {{{
-   * Source<Integer, ?> nums = Source.from(Arrays.asList(0, 1, 2, 3));
+   * Source<Integer, ?> nums = Source.from(List.of(0, 1, 2, 3));
    * nums.intersperse(",");            //   1 , 2 , 3
    * nums.intersperse("[", ",", "]");  // [ 1 , 2 , 3 ]
    * }}}
diff --git 
a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala 
b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala
index 18ad5712bc..b36987ad7b 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala
@@ -999,7 +999,7 @@ final class SubSource[Out, Mat](
    * Examples:
    *
    * {{{
-   * Source<Integer, ?> nums = Source.from(Arrays.asList(0, 1, 2, 3));
+   * Source<Integer, ?> nums = Source.from(List.of(0, 1, 2, 3));
    * nums.intersperse(",");            //   1 , 2 , 3
    * nums.intersperse("[", ",", "]");  // [ 1 , 2 , 3 ]
    * }}}
@@ -1033,7 +1033,7 @@ final class SubSource[Out, Mat](
    * Examples:
    *
    * {{{
-   * Source<Integer, ?> nums = Source.from(Arrays.asList(0, 1, 2, 3));
+   * Source<Integer, ?> nums = Source.from(List.of(0, 1, 2, 3));
    * nums.intersperse(",");            //   1 , 2 , 3
    * nums.intersperse("[", ",", "]");  // [ 1 , 2 , 3 ]
    * }}}
@@ -2354,7 +2354,7 @@ final class SubSource[Out, Mat](
    *
    * Example:
    * {{{
-   * Source.from(Arrays.asList(1, 2, 
3)).interleave(Source.from(Arrays.asList(4, 5, 6, 7), 2)
+   * Source.from(List.of(1, 2, 3)).interleave(Source.from(List.of(4, 5, 6, 7), 
2)
    * // 1, 2, 4, 5, 3, 6, 7
    * }}}
    *


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to