Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing a value from a map

Tags:

java

I have a Map<Something, List<String>> map. I want to remove a String from the List<String>.

Is that possible ? How do I do that ?

I don't want to remove the mapping, just alter the 'value' of an entry.

I have tried map.values().remove("someString"), but that doesn't seem to work.

like image 899
l0r3nz4cc10 Avatar asked Feb 05 '26 08:02

l0r3nz4cc10


1 Answers

Try map.get(somethingKey).remove("someString").

like image 102
Peter Avatar answered Feb 07 '26 22:02

Peter