Suppose this is the HashMap you are defining:
In HashMap.java, there is this decleration.
This Set stored all the Entry class objects. Entry class objects are the objects which stores key-value pair in HashMap. Entry class has fields [K key,V value,Map.Entry<K,V> next] etc. This diagram will give you a idea about how java implement HashMap and store key-values:
Code to Iterate:
Suppose you are storing ArrayList as a Value(V) in HashMap. Now you need to sort all the ArrayList’s stored in HashMap. You can do this via iterating over HasMap and get the Object of ArrayList then you can sort it.comments powered by Disqus