What is hashcode and equals method | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

What is hashcode and equals method

Difference

3rd Aug 2022, 11:47 AM
YARAMATI GOPALA KRISHNA
YARAMATI GOPALA KRISHNA - avatar
1 Antwort
0
hashCode() converts an object to a near-unique int number as its identifier, but it is not 100% unique. equals() compares two objects if they are the same. It should be 100% the same (by selected criteria). in HashMap if two (or more) object has the same hashCode then the equals method is used by searching between these two objects
3rd Aug 2022, 2:38 PM
zemiak