HashMap with Entryset Example
[java]package cool;
import java.util.HashMap;
import java.util.Map;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class hashmap {
/**
* @param args
*/
public static void main(String[] args) {
HashMap<String, String> myMap = new HashMap<String, String>();
myMap.put("ind", "india");
myMap.put("tn", "tamilnadu");
myMap.put("blr","bangalore");
Set<Entry<String,String>> set = myMap.entrySet();
for (Map.Entry<String, String> me : set) {
if(me.getKey().equalsIgnoreCase("tn")){
System.out.println(me.getValue());
}
}
}
}[/java]