Hello all, I was wondering if anyone knows the standard way in which
java implements hashCode?
I want to be able to take two keys and make sure that they are placed
within the same 'bucket' in a hashtable. This is probably bit strange
of an operation, but I need to do it (long story). One key will be set
and an integer, the other can be anything. The size of the hashtable
will be known so that I could create it with a predetermined size.
I figure I could just write my own hashCode and equals, but if possible
I'd rather manipulate the standard way.
Any help would be appreciated.
Thomas Schodt - 19 Apr 2005 06:59 GMT
> Hello all, I was wondering if anyone knows the standard way in which
> java implements hashCode?
[quoted text clipped - 7 lines]
> I figure I could just write my own hashCode and equals, but if possible
> I'd rather manipulate the standard way.
If you peek at the source you'll see that
Integer.hashCode()
just returns the int it encapsulates.