Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create immutable MultiValueMap wrapper #27608

Closed
poutsma opened this issue Oct 25, 2021 · 0 comments
Closed

Create immutable MultiValueMap wrapper #27608

poutsma opened this issue Oct 25, 2021 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@poutsma
Copy link
Contributor

poutsma commented Oct 25, 2021

Currently, CollectionUtils::unmodifiableMultiValueMap returns an (unmodifiable) copy of the target map, and therefore allocates extra memory. We cannot use the Collections.unmodifiableMap wrapper in said method, because each value of the map should be immutable as well, and thus needs a Collections.unmodifiableList wrapper.

We should create a UnmodifiableMultiValueMap wrapper, similar to the JDK Collections, that wraps entries and values with immutable counterparts where needed.

@poutsma poutsma added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Oct 25, 2021
@poutsma poutsma added this to the 6.0 M1 milestone Oct 25, 2021
@poutsma poutsma self-assigned this Oct 25, 2021
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 25, 2021
This commit introduces UnmodifiableMultiValueMap, an immutable wrapper
around a MultiValueMap, similar to what is returned by
Collections.unmodifiable*.
CollectionUtils::unmodifiableMultiValueMap now returns
UnmodifiableMultiValueMap.

Closes spring-projectsgh-27608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant