Java HashMap: hashcode vs equals

Pubblicato il: 03 aprile 2018
sul canale di: 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.


In questa pagina del sito puoi guardare il video online Java HashMap: hashcode vs equals della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Developers Greenfield 03 aprile 2018, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 3,063 volte e gli è piaciuto 40 spettatori. Buona visione!