Suppose you declared HashMap as :-
HashMap<Character,Integer> hs = new HashMap<>();
Then,key in map is of type Character data type and value of int type.Now,to get value corresponding to key irrespective of type of key,value type, syntax is :-
char temp = 'a';
if(hs.containsKey(temp)){
` int val = hs.get(temp); //val is the value corresponding to key temp
}
So, according to your question you want to get string value corresponding to a key.For this, just declare HashMap as HashMap<"datatype of key","datatype of value" hs = new HashMap<>(); Using this will make your code cleaner and also you don't have to convert the result of hs.get("my_code") to string as by default it returns value of string if at entry time one has kept value as a string.