Linked Questions

Popular Questions

Any way to modify an Unmodifiable Collection

Asked by At

I am receiving a HashMap from upstream which is unmodifiable. When i try to modify it, I received an error: UnsuppotedOperatinException which makes sense as i didn't realized i am trying to modify the unmodifiable collection.

But i really need to modify the hashmap as i have sensitive information from that map which i need to pass to downstream. Any suggestions on how can we do this?

I saw this thread:

Is there any way to modify an unmodifiable collection?

but still the copy constructor is creating an unmodifiable collection. Any suggestions are helpful.

Related Questions