c******n 发帖数: 4965 | 1 If you override equals, you should also override hashCode()
barely documented ....
http://leepoint.net/notes-java/data/expressions/22compareobjects.h/tml | g*****g 发帖数: 34805 | 2 Every java developer knows this.
【在 c******n 的大作中提到】 : If you override equals, you should also override hashCode() : barely documented .... : http://leepoint.net/notes-java/data/expressions/22compareobjects.h/tml
| c******n 发帖数: 4965 | 3 the Ken Arnold book ("the java programming language") doesn't mention this,
javadoc doesn't mention this.
I wonder I must be missing some learning steps, where did u pick this up?
【在 g*****g 的大作中提到】 : Every java developer knows this.
| g*****g 发帖数: 34805 | 4 http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals(java.lang.Object)
"Note that it is generally necessary to override the hashCode method
whenever this method is overridden, so as to maintain the general contract
for the hashCode method, which states that equal objects must have equal
hash codes. "
【在 c******n 的大作中提到】 : the Ken Arnold book ("the java programming language") doesn't mention this, : javadoc doesn't mention this. : I wonder I must be missing some learning steps, where did u pick this up?
|
|