Arun Chidam wrote:How HashMap stores key if all the added objects has same hashcode(say 1)
you cant talk about adding an object in HashMap with only hashCode.you need to mention equals method also. what about equals method of all objects? if equals method of all objects are same then recent entry will replace existing and so on... else all the objects will go into one single bucket; bad programing style.
Arun Chidam wrote:
does it maintain internal subset of Key+value as key, if so what is the data type of subset(is it stored as hashmap inside hashmap)?
nope. key+value wrapped into an Object called Entry and put into an Array. the base datastructure for the Hashtable/HashMap is an array.
for more details you can view the source code of java.util.HashMap.