How to remove an element of a HashMap whilst streaming (lambda)

Solution 1:

map.entrySet().removeIf(entry -> entry.getValue().equals("0"));

You can't do it with streams, but you can do it with the other new methods.

EDIT: even better:

map.values().removeAll(Collections.singleton("0"));

Solution 2:

If you want to remove the entire key, then use:

myMap.entrySet().removeIf(map -> map.getValue().containsValue("0"));