What is hash table in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is hash table in java?

27th Aug 2019, 10:38 AM
Mohammad Obydul Islam
Mohammad Obydul Islam - avatar
2 Answers
+ 4
Hashtable maps keys to values. Any non-null object can be used as a key or as a value. To successfully store and retrieve objects from a hashtable, the objects used as keys must implement the hashCode method and the equals method. - It is similar to HashMap, but is synchronised. - Hashtable stores key/value pair in hash table. - In Hashtable we specify an object that is used as a key, and the value we want to associate to that key. The key is then hashed, and the resulting hash code is used as the index at which the value is stored within the table.
27th Aug 2019, 12:17 PM
Tashila Pathum
Tashila Pathum - avatar
+ 3
Tashila Pathum thank u very much for your valuable answer.
28th Aug 2019, 5:56 AM
Mohammad Obydul Islam
Mohammad Obydul Islam - avatar