I implemented a function which return Map<key,Set<objects>> , when I call this function it return the sets with type Unmodifiable.
I need to do some operations to this sets, how to convert them to modifiable sets in best practice? Otherwise I got
Exception in thread "main" java.lang.UnsupportedOperationException
Thanks in advance.
You could copy the original set to another one that can be modified.
Something like this:
Then, you could modify the new list without any problem, and re-assign it into the map.