Pre Exam Test Practice
Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
get string value from HashMap depending on key name in java collection
I have a HashMap with various keys and values, how can I get one value out?
I have a key in the map called my_code, it should contain a string, how can I just get that without having to iterate through the map?
So far I've got..
¬†¬†¬†HashMap newMap = new HashMap(paramMap);
¬†¬†¬†String s = newMap.get("my_code").toString();
I'm expecting to see a String, such as "ABC" or "DEF" as that is what I put in there initially, but if I do a System.out.println() I get something like java.lang.string#F0454
Sorry, I'm not too familiar with maps as you can probably guess ;)
Jun 19, 2015
to add a comment.
Related Hot Questions
Government Jobs Opening