You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2026/06/23 01:34:01 UTC

[PR] docs: update Scaladoc examples from Arrays.asList to List.of [pekko]

He-Pin opened a new pull request, #3140:
URL: https://github.com/apache/pekko/pull/3140

   ### 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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] docs: update Scaladoc examples from Arrays.asList to List.of [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #3140:
URL: https://github.com/apache/pekko/pull/3140#discussion_r3458457244


##########
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))

Review Comment:
   can we change this then? to just `val toList = (m1: M) => util.List.of(m1)`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] docs: update Scaladoc examples from Arrays.asList to List.of [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #3140:
URL: https://github.com/apache/pekko/pull/3140#discussion_r3458252182


##########
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))

Review Comment:
   do we need the mutable ArrayList wrapper?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] docs: update Scaladoc examples from Arrays.asList to List.of [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #3140:
URL: https://github.com/apache/pekko/pull/3140#discussion_r3458300007


##########
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))

Review Comment:
   no I think.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] docs: update Scaladoc examples from Arrays.asList to List.of [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #3140:
URL: https://github.com/apache/pekko/pull/3140


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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