Internals of how the HashMap put() and get() methods work (basic logic only )

If you talk about higher picture it is just like below.Here i refer item as a key of Map

While Putting items.

  1. Calculate hashcode of key
  2. If basket with that hashcode is present then use the equals method on the key search the keys i that basket to determine if the element is to be added or replace.
  3. If not there then create new basket (rehashing) and add that element to that.

Get:

  1. Get the hashcode of key
  2. Go to that basket
  3. Iterate using equals on the key will return you that element from that basket.