Java HashMap: hashcode vs equals

Publié le: 03 avril 2018
sur la chaîne: Developers Greenfield
3,063
40

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.


Sur cette page du site, vous pouvez voir la vidéo en ligne Java HashMap: hashcode vs equals durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Developers Greenfield 03 avril 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 3,063 fois et il a aimé 40 téléspectateurs. Bon visionnage!