0
What is the difference between hashcode() and equals()?
3 Respuestas
+ 1
Uhm, ok.
You always should override both of them.
Very short (and incomplete) answer:
equals() is for comparison of two Objects like in
boolean eq = "a".equals(new String("a"));
hashCode _and_ equals are needed for Sets and Maps, if you want to know, if they contain a Object.
0
Code says more than a thousand words.
I quickly wrote an example for you.
Look at my codes, "Difference between equals() and hashCode()" explains it very well.
0
I misunderstood your code
could you explain more