On 10 Aug 2004 19:29:59 -0700, pentium77 wrote:
Just wondering what's the algo used to compute hashcode in Java ? Does
anybody here know ?
Read the documentation for Object.hashCode().
There is no single algorithm for computing hashcodes, it depends on
what your data consists of. You most likely don't use the same
algorithm to compute the hashcode of an Integer and an EmployeeRecord.
The important details are that the hashcode for an object cannot
change, and that two objects that are equal must have the same
hashcode (that doesn't mean that objects that are not equal must have
different hashcodes, although that is usually desireable).
/gordon
--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e