Initialize Map with correct size in RequestPredicates
Fix another instance where a LinkedHashMap was initialized with an initial capacity that would always cause a resize / rehash to occur. Switch to CollectionUtils.newLinkedHashMap to size the map appropiately for the expected number of items. Closes gh-32215
This commit is contained in:
committed by
Brian Clozel
parent
78c96b6d78
commit
4486ab1cb7
@@ -1237,7 +1237,7 @@ public abstract class RequestPredicates {
|
||||
PathPattern oldPathPattern = (PathPattern) request.attribute(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE)
|
||||
.orElse(null);
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>(2);
|
||||
Map<String, Object> result = CollectionUtils.newLinkedHashMap(2);
|
||||
result.put(RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE, mergeMaps(oldPathVariables, newPathVariables));
|
||||
result.put(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE, mergePatterns(oldPathPattern, newPathPattern));
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user