HashMap with Entryset Example

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());

		}

	}

}
}

597 total views, 1 views today

About: Mirthbees

Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in