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.