Post a Job  |   Ask a Question?   |   Already registered? login or register
ramesh kumar
02/02/2016 02:05 PM

why hashmap internal datastructure is called as hashtable?


why it is called hashtable,even though it intarnally implemented as array of bucket and each bucket is linkedlist,why can't just we called as array of linkedlist? why they use term called table?
Spam    1 Comments

Munendra,Kumar
02/02/2016 17:13:46
Hi Ramesh, did you know internally HashTable uses chaining process and what is the reason behind it.If you really don't know then check it intrnals once. and if you really wanted to know why hashmap internal datastructure is called as hashtable then take one example by using HashTable<integer,integer> ht = new HashTable(); ht.put(10,20); Sysout(ht);it returns {10=20} Sysout(ht.put(10,30));//it returns 20 and new value 30 inserted in placed of it HashMap<integer,integer>hm = new HashMap(); hm.put(10,20); Sysout(hm);//it returns {10=20} Sysout(hm.put(10,30));//it returns 20 and new value 30 inserted in placed of it So the bottomline is behaviour of HashMap similar to Hashtable,because way of organized the data (structured mannes) in HashMap is HashTable. I hope Ramesh,this will help you.

Languages :
xml