Basically, I've the following code:
Map<Integer, String> map = new HashMap<Integer, String>();
map.put(1, "test");
map.put(2, "test2");
// I can get the string using this:
String str = map.get("test2");
// but how do I get the index ('key') of "test2"?
The code is pretty much self explanatory. How do I get the '2'? Is it essential to use a loop?