[robsite.org]

« Tweak default Mac OS X keymap to be more Windows/Linux like. | Main | EJB 3.0 Preview for Oracle Application Server. »

March 03, 2005

equals and hashCode

I see this mentioned on blogs fairly regularly, and it's always a surprise for people when they learn you have to override hashCode if you override equals.

In short: If you override equals, you must override hashCode.

(From the Javadoc comments from java.lang.Object)
The general contract of hashCode is:

Here are a couple of references: