Posts

Showing posts with the label Java HashMap basics and its internal implementation

HashMap basics and its internal implementation

Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. In this post we will learn about basics of HashMap and its internal implementation. What is HashMap? HashMap implements Map interface. Collection view of a Map can be obtained using entrySet() method. To obtain a collection-view of the keys, keySet() method can be used. HashMap is not synchronized and allows null keys and values whereas HashTable is synchronized. An instance of HashMap has two parameters that affect its performance:  initial capacity  load factor.  The capacity is the number of buckets in the hash table, and the initial capacity is simply the capacity at the time the hash table is created.  The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. When the number of entries