0
why use hashCode()
why we use hashCode() for equals ?
1 Antwort
+ 3
Hascode is a number that is obtained in base to an algorithm (usually involves the properties of your object in the operations, that's why generally you have to override the method from the original in object class) so than number is the result and is unique (we hope)
Then you override the equal method to search if 2 hascode numbers are equals and because that numbers were obtained from the object properties, if they are equal you can assume that 2 objects are the same