<SadEagle> public int hashCode() {
<SadEagle> /* This is probably a fairly bad hash function */
<SadEagle> return 0;
<SadEagle> }What passes for grad work today... LOL
Submitted by manyoso on Mon, 09/19/2005 - 02:23.
Personal
Although it should be noted...
In Java, it is a violation of contract for objects for which:
But it is done all the time - how often do you see equals overriden without overriding the default hashcode, under which all objects are unique?
If you are just creating some objects that you know will be compared for equality, but you don't think they'll ever be hashed, returning a constant is a hackish but quick and not too inelegent way of keeping within the rules.