Ref: Java Hashmap: How to get key from value?
private Object getKeyFromValue(Map map, Object value) {
for (Object object : map.keySet()) {
if (map.get(object).equals(value)) {
return object;
}
}
return null;
}