/** * This method gets the Key for the given Value * @param paramName * @return */private String getKeyForValueFromMap(String paramName) { String keyForValue = null; if(paramName!=null)) { Set<Entry<String,String>> entrySet = myMap().entrySet(); if(entrySet!=null && entrySet.size>0) { for(Entry<String,String> entry : entrySet) { if(entry!=null && paramName.equalsIgnoreCase(entry.getValue())) { keyForValue = entry.getKey(); } } } } return keyForValue;}
↧
Answer by kanaparthikiran for Java Hashmap: How to get key from value?
↧