menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Internal W...
source image

Medium

21h

read

52

img
dot

Internal Working of HashMap

  • HashMap uses an array of buckets where each bucket can hold one or more key-value pairs.
  • When inserting a key, its hashCode() is calculated to find the index in the array.
  • Collisions are resolved by storing keys in a linked list or Red-Black Tree if entries grow beyond 8 (Java 8+).
  • Searching in HashMap involves using the hash to locate the correct bucket and checking entries with .equals().

Read Full Article

like

3 Likes

For uninterrupted reading, download the app