Java HashMap: hashcode vs equals

preview_player
Показать описание
HashCode and equals methods and impact of Java HashMap implementation on them. Java HashMap implementation uses key's object "hashCode" method to calculate bucket within its internal hash table. However when two different objects in terms of "equals" method produce the same hashcode then HashMap performace decreases as it stores them in the form of linked list under spectific bucket entry. More dangerous problem arises when two the same objects in terms of "equals" method return different hashcode.This will lead to memory leak and logic of your program may fail.
Рекомендации по теме
Комментарии
Автор

Thanks for the video!! explained very well.

sasinghc