Java tutorial
//package com.java2s; import java.util.Iterator; import java.util.Map; import java.util.Set; public class Main { @SuppressWarnings("rawtypes") public static String getKeyByValue(Map<?, String> hm, String value) { Set<?> s = hm.entrySet(); Iterator<?> it = s.iterator(); while (it.hasNext()) { Map.Entry m = (Map.Entry) it.next(); if (m.getValue().equals(value)) return m.getKey() + ""; } return null; } }