+ 7
Why do you override the equals() method?
4 Antworten
+ 18
Additional to Bhabeshs answer, if you override equals you have to override hashCode as well.
Because if a.equals(b), a.hashCode() must be the same as b.hashCode().
+ 4
Because without overriding it works same as == operator which check for reference not for content equality.
+ 4
@Tashi, Congratulations for Moderator badge. You really deserved it :-)
+ 1
That's perfect Tashi. (y)