DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

What should HashCode#hashCode() return when there's more than 4 bytes? #1494

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Right now, we just return asInt() if the HashCode has >= 4 bytes.

We probably want to do something a bit more intelligent though, otherwise 
hashcodes with > 4 bytes that all have the same low order bits will all return 
the same hash code.

Seems reasonable to just hash all the bytes together, no?

Original issue reported on code.google.com by kak@google.com on 5 Aug 2013 at 6:52

GoogleCodeExporter commented 9 years ago
Hmm, sounds reasonable to me.

Original comment by cgdecker@google.com on 5 Aug 2013 at 7:03

GoogleCodeExporter commented 9 years ago
Since these should already be high-quality hash codes to begin with, the change 
you suggest doesn't actually alter the collision probability any, so I think it 
would have no purpose.

Original comment by kevinb@google.com on 5 Aug 2013 at 8:33

GoogleCodeExporter commented 9 years ago

Original comment by kak@google.com on 6 Aug 2013 at 5:01

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08