Optimize: entrySet is faster than keySet + get to prevent N lookups (#10496)

* Optimize: replace keySet + N get calls with entrySet saving N calls to get method in a few places

* missed one performance optimization

* Rolling back a change that was dependent on Java 11
This commit is contained in:
Larry Diamond
2021-10-04 04:37:34 -04:00
committed by GitHub
parent 768c76ea33
commit 10b310d33f
16 changed files with 107 additions and 71 deletions

View File

@@ -721,8 +721,9 @@ public class CodeGenMojo extends AbstractMojo {
getLog().warn("environmentVariables is deprecated and will be removed in version 5.1. Use globalProperties instead.");
}
for (String key : globalProperties.keySet()) {
String value = globalProperties.get(key);
for (Map.Entry<String, String> globalPropertiesEntry : globalProperties.entrySet()) {
String key = globalPropertiesEntry.getKey();
String value = globalPropertiesEntry.getValue();
if (value != null) {
configurator.addGlobalProperty(key, value);
}