Java Hashmap: How to get key from value?

前端 未结 30 1854
忘掉有多难
忘掉有多难 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 02:54

    It's important to note that since this question, Apache Collections supports Generic BidiMaps. So a few of the top voted answers are no longer accurate on that point.

    For a Serialized BidiMap that also supports duplicate values ( 1-to-many scenario ) also consider MapDB.org.

提交回复
热议问题