I have a HashMap in Java, the contents of which (as you all probably know) can be accessed by
HashMap.get(\"keyname\");
If a have a HashMap
Yes, if you use the proper generic type signature for the outer hashmap.
HashMap> hm = new HashMap>();
// populate the map
hm.get("keyname").get("nestedkeyname");
If you're not using generics, you'd have to do a cast to convert the object retrieved from the outer hash map to a HashMap
(or at least a Map
) before you could call its get()
method. But you should be using generics ;-)