- #1
- 14,981
- 26
I'm writing a program that likes to test for equality simply by checking identity: IOW, a.equals(b) iff a == b.
Now, I think I would like to use HashMap's and stuff... so I would like to be able to use the appropriate accompanying hashCode method... that is, the default implementation of the hashCode method! It's the appropriate companion for my equality testing method, and it's quick as well... but I don't know how to access it if I'm handling an object that has overridden hashCode.
Now, I think I would like to use HashMap's and stuff... so I would like to be able to use the appropriate accompanying hashCode method... that is, the default implementation of the hashCode method! It's the appropriate companion for my equality testing method, and it's quick as well... but I don't know how to access it if I'm handling an object that has overridden hashCode.