You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/08/19 00:40:58 UTC

[GitHub] [dolphinscheduler] ruanwenjun commented on a change in pull request #6004: [Improvement] Fix inefficient map iterator

ruanwenjun commented on a change in pull request #6004:
URL: https://github.com/apache/dolphinscheduler/pull/6004#discussion_r691695436



##########
File path: dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
##########
@@ -251,8 +251,9 @@ public void dealOutParam(String result) {
                 sqlResultFormat.put(key, new ArrayList<>());
             }
             for (Map<String, String> info : sqlResult) {
-                for (String key : info.keySet()) {
-                    sqlResultFormat.get(key).add(String.valueOf(info.get(key)));
+                for (Map.Entry<String, String> entry : info.entrySet()) {
+                    String key = entry.getKey();
+                    sqlResultFormat.get(key).add(String.valueOf(entry.getValue()));

Review comment:
       Can we remove the String.valueOf() here? and it seems we use forEach is clearer
   ```java
   info.foreach((key, value) -> {
   sqlResultFormat.get(key).add(value);
   })
   ```




-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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