You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/12/11 10:34:08 UTC

[GitHub] [incubator-eventmesh] walterlife commented on a diff in pull request #2555: [Enhancement] Manual array to collection copy

walterlife commented on code in PR #2555:
URL: https://github.com/apache/incubator-eventmesh/pull/2555#discussion_r1045209299


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java:
##########
@@ -57,22 +58,17 @@ public static String getLocalAddress() {
         //priority of networkInterface when generating client ip
         String priority = System.getProperty("networkInterface.priority", "eth0<eth1<bond1");
 
-        ArrayList<String> preferList = new ArrayList<String>();
-        for (String eth : priority.split("<")) {
-            preferList.add(eth);
-        }
+        ArrayList<String> preferList = new ArrayList<>(Arrays.asList(priority.split("<")));

Review Comment:
   It is recommended to split it into two lines. The responsibilities of each line will be clearer.
   ArrayList<String> preferList = new ArrayList<String>();
   preferList.addAll(Arrays.asList(priority.split("<"));
   @weihubeats 



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org