HashMap does have a method for retrieving a record, but it is a closed package. I'm not quite sure why this is not public, to be honest. I don’t think he reveals anything. You can, of course, call it reflection.
Map<String, String> map = new HashMap<String, String>();
map.put(new String("hello"), "world!");
Method method = (
HashMap.class.getDeclaredMethod("getEntry", Object.class)
);
method.setAccessible(true);
@SuppressWarnings("unchecked")
Map.Entry<String, String> entry = (Map.Entry<String, String>)(
method.invoke(map, new String("hello"))
);
System.out.println(entry.toString().replace("=", " "));
Reflection probably makes it not useful in the scenario you described, but I think it might be useful to others. I would not recommend using it.