Add immutable MultiValueMap wrapper

This commit introduces UnmodifiableMultiValueMap, an immutable wrapper
around a MultiValueMap, similar to what is returned by
Collections.unmodifiable*.
CollectionUtils::unmodifiableMultiValueMap now returns
UnmodifiableMultiValueMap.

Closes gh-27608
This commit is contained in:
Arjen Poutsma
2021-10-25 15:25:39 +02:00
parent 6fd0615be9
commit 0a58419df4
4 changed files with 917 additions and 8 deletions

View File

@@ -479,8 +479,9 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
result = new OpaqueUriComponents(this.scheme, this.ssp, this.fragment);
}
else {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>(this.queryParams);
HierarchicalUriComponents uric = new HierarchicalUriComponents(this.scheme, this.fragment,
this.userInfo, this.host, this.port, this.pathBuilder.build(), this.queryParams,
this.userInfo, this.host, this.port, this.pathBuilder.build(), queryParams,
hint == EncodingHint.FULLY_ENCODED);
result = (hint == EncodingHint.ENCODE_TEMPLATE ? uric.encodeTemplate(this.charset) : uric);
}