LuciferYang edited a comment on pull request #33558: URL: https://github.com/apache/spark/pull/33558#issuecomment-888771778
> There is one other instance you could change in AbstractCommandBuilder.getEffectiveConfig The original method as follows: ```java Map<String, String> getEffectiveConfig() throws IOException { if (effectiveConfig == null) { effectiveConfig = new HashMap<>(conf); Properties p = loadPropertiesFile(); for (String key : p.stringPropertyNames()) { if (!effectiveConfig.containsKey(key)) { effectiveConfig.put(key, p.getProperty(key)); } } } return effectiveConfig; } ``` @srowen do you mean refactor the ```java for (String key : p.stringPropertyNames()) { if (!effectiveConfig.containsKey(key)) { effectiveConfig.put(key, p.getProperty(key)); } } ``` to ``` p.stringPropertyNames().forEach(key -> effectiveConfig.putIfAbsent(key, p.getProperty(key))); ``` or refactor to ``` p.stringPropertyNames().forEach(key -> effectiveConfig.computeIfAbsent(key, p::getProperty)); ``` Both can pass the test. But the first will call `p.getProperty(key)` for each key, which is different from the original logic. And The second has the problem of ignoring the return value of `computeIfAbsent` method. Which way do you prefer or keep the original logic? -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org