Java Hashmap: How to get key from value?

前端 未结 30 1860
忘掉有多难
忘掉有多难 2020-11-22 02:14

If I have the value \"foo\", and a HashMap ftw for which ftw.containsValue(\"foo\") returns true, how can I

30条回答
  •  你的背包
    2020-11-22 03:06

    To find all the keys that map to that value, iterate through all the pairs in the hashmap, using map.entrySet().

提交回复
热议问题