Remove entry from Map<String, Set> by value

How can I remove the entry from
Map<String, Set<String>> by only one string value in the Set. So if Set<String> contains passed String then I want KV pair to be removed from Map.


You’re going to have to do it the hard way: iterate over the map using the key. Grab the Set and check whether that set contains the string you’re looking for. If it does, you remove the entry from the map.

Leave a Reply

Your email address will not be published. Required fields are marked *