HashMap.containsValue - What's the point?
问题 I've got a HashMap and I need to fetch an item by its integer value. I notice there's a containsValue() function, but it would appear I still have to iterate through the map to find the correct index anyway. My question is; why use containsValue() if I'm required to traverse it afterwards? Also, am I missing the point completely? ;-) 回答1: A map maps a key to a value. If you have a value and you know the map contains this value, why do you need the key anymore? On the other hand, if you really