Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Let's circle back to the Quidditch project.
I ended the last Quidditch lesson by saying that for Hashmark to retrieve the key, it's not enough
for an object to be equal to it.
It must also share the same hash code.
Hash map uses the hash code to find which bucket the key is in.
And after it finds the bucket it can use equals to compare your object against the key.
So when you add an equals method, you must always add a hash code method that assigns equal object
to the same hash code.
If you don't do that, you're going to get bugs.
So here in Team Not Java, since we have an equals method, we must also add a hash code method, public
and tache code.
And here we can use the hash method to assign an object to hash code based on its fields'.
In this case, house.
Keeper seeker.
And from experience, the hash method doesn't work with a race, so pass the string representation of
the array, which is the same thing because equal objects are going to end up having the same Chaser's
string.
Ultimately, this hash method is going to assign equal object to the same hash code.
And now I'm confident that our code should work.
And it does work get score returns, the score for Gryffindor, the parameter we're passing in is equal
to the key that we're interested in, which means they have the same hash code.
We can test set score as well.
And it works at Update's Gryffindor score to 10, the hash map was able to find a key that matches the
hash code and a quality of the one we're passing in.
So it knows that we're trying to update this particular key.
So I really want to stress this.
When you add an equals method, you must always, always add a hash code method.
Otherwise you're going to get bugs from hash based collections.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.