If I have the value \"foo\", and a HashMap ftw for which ftw.containsValue(\"foo\") returns true, how can I
\"foo\"
HashMap ftw
ftw.containsValue(\"foo\")
true
public static String getKey(Map mapref, String value) { String key = ""; for (Map.Entry map : mapref.entrySet()) { if (map.getValue().toString().equals(value)) { key = map.getKey(); } } return key; }