How HashMap Works Internally in Java | Hashing, Hash Collision Explained
Автор: The Curious Coder
Загружено: 2025-12-13
Просмотров: 736
What really happens behind the scenes when you call hashmap.put(), hashmap.get(), or hashmap.remove() ?
I start by explaining how a HashMap looks underneath, how it stores a key value pair, and how hashing in Java determines the exact bucket (array index) where the data will be stored. You’ll see how a hash function is used to compute the index inside the hash table, and how hash collisions occur when two keys land in the same bucket.
We’ll also look at how HashMap in Java was originally implemented as an array of LinkedLists, and how after Java 8, once a certain threshold is crossed, the LinkedList in a bucket gets converted into a balanced BST. This part is crucial for understanding how HashMap works internally in Java 8 and why performance improved so much.
Throughout the video, I explain step-by-step how the internal operations work:
• how hashmap.put() inserts a key-value pair
• how hashmap.get() searches and fetches data
• how hashmap.remove() deletes entries
• and how complexities differ before and after Java 8
You’ll also learn what hashing is, why collisions happen, and how the HashMap implementation in Java handles these collisions.
By the end of this session, you’ll have a complete, intuitive understanding of internal implementation of HashMap.
Instagram :
/ the.curious_coder
#interview #springboot #java
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: