On Fri, 18 Apr 2008 12:02:27 -0700, Patricia Shanahan <pats@acm.org> wrote:
I admit...I don't get his reasoning.
First of all, 0 is a very unusual hash code to return. I suppose
it's always possible, but unless you're dealing with some type that
is 32-bits or less and just returns its own value as the hash code,
it doesn't seem likely.
Integer has only 32 bits of state, returns its own value as the hash
code, and zero is not an unusual value for an integer.
Wow. You even quoted the part where I wrote "unless you're dealing with
some type that is 32-bits or less" (e.g. Integer) and yet still saw the
need to comment?
In any case, so what? In the example I posted, none of the constituent
members were integers, nor is that really relevant anyway. The initial
value of the hash calculation doesn't change the likelihood of
collisions with respect to potential zero inputs for the calculation.
return". Its truth is not at all obvious to me.