Polishing contribution

Closes gh-34783
This commit is contained in:
rstoyanchev
2025-04-23 10:53:51 +01:00
parent 124582d910
commit 858c2bd270
2 changed files with 8 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -451,11 +451,10 @@ final class HierarchicalUriComponents extends UriComponents {
UriTemplateVariables queryVariables = new QueryUriTemplateVariables(variables);
this.queryParams.forEach((key, values) -> {
String name = expandUriComponent(key, queryVariables, this.variableEncoder);
List<String> expandedValues = result.getOrDefault(name, new ArrayList<>(values.size()));
List<String> expandedValues = result.computeIfAbsent(name, k -> new ArrayList<>(values.size()));
for (String value : values) {
expandedValues.add(expandUriComponent(value, queryVariables, this.variableEncoder));
}
result.put(name, expandedValues);
});
return CollectionUtils.unmodifiableMultiValueMap(result);
}