What\'s the quickest way to remove an element from a Map by value in Java?
Currently I\'m using:
DomainObj valueToRemove = new DomainObj(); S
A shorter usage of iterator is to use a values() iterator.
DomainObj valueToRemove = new DomainObj(); for (Iterator it = map.values().iterator(); it.hasNext();)) { if (valueToRemove.equals(it.next())) { it.remove(); break; } }