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
If you have no way to figure out the key from the DomainObj, then I don't see how you can improve on that. There's no built in method to get the key from the value, so you have to iterate through the map.
If this is something you're doing all the time, you might maintain two maps (string->DomainObj and DomainObj->Key).