I need a method to remove a entryset from hashmap by it's value. Is there a simple method without iteration?
There's a simple method, but it'll use iteration internally. (There's no way around that.)
map.values().remove(valueToRemove);
Not in HashMap but google-guava has a BiMap and you could do it like below pseudo-code
BiMap m=new HashBiMap();
m.inverse().remove(valueYouWantToRemove)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.