Retrieving Hashmap value by comparing hashmap key



import java.util.HashMap;
import java.util.Map.Entry;

public class Hashmap {
	public static void main(String[] args) {
		String keyword="super";
		HashMap<String, String> myMap = new HashMap<String, String>();
		myMap.put("super", "java keyword");
		myMap.put("array_merge", "php array function");
		for (Entry<String, String> pair : myMap.entrySet()) {
		       System.out.println(keyword+" is: " + pair.getValue());




super is: java keyword

Thanks for reading this post…….!!!

 970 total views,  3 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.