LATEST UPDATES

Friday 18 November 2016

How HashMap works in Java ?


  • The HashMap requires a hash function and uses hashCode and equals methods, in order to put and retrieve elements to and from the collection respectively. 
  • When the put method is invoked, the HashMap calculates the hash value of the key and stores the pair in the appropriate index inside the collection. 
  • If the key exists, its value is updated with the new value. 
  • Some important characteristics of a HashMap are its capacity, its load factor and the threshold resizing.

No comments:

Post a Comment

Designed By Blogger Templates