Performance improvement
Use entrySet instead of keySet followed by a lookup per key as the former is more efficient. Issue: SPR-12363
This commit is contained in:
parent
d9df50c6cd
commit
d62522982f
|
|
@ -127,9 +127,10 @@ public class ModelMap extends LinkedHashMap<String, Object> {
|
||||||
*/
|
*/
|
||||||
public ModelMap mergeAttributes(Map<String, ?> attributes) {
|
public ModelMap mergeAttributes(Map<String, ?> attributes) {
|
||||||
if (attributes != null) {
|
if (attributes != null) {
|
||||||
for (String key : attributes.keySet()) {
|
for (Map.Entry<String, ?> entry : attributes.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
if (!containsKey(key)) {
|
if (!containsKey(key)) {
|
||||||
put(key, attributes.get(key));
|
put(key, entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue