Timeline for Best implementation for hashCode method for a collection
Current License: CC BY-SA 2.5
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 10, 2017 at 19:25 | comment | added | maaartinus | @KrzysztofJabłoński Right. Moreover, swapping foo and bar produces a needless collision, too. | |
| Apr 30, 2013 at 6:34 | comment | added | Krzysztof Jabłoński | Like SquareCog have already noticed. If hashcode is generated once from concatenation of two strings it is extremely easy to generate masses of collisions: ("abc"+""=="ab"+"c"=="a"+"bc"==""+"abc"). It is severe flaw. It would be better to evaluate hashcode for both fields and then calculate linear combination of them (preferably using primes as coefficients). | |
| Sep 22, 2008 at 7:28 | history | edited | Chris Carruthers | CC BY-SA 2.5 | deleted 1147 characters in body |
| Sep 22, 2008 at 7:13 | history | edited | Chris Carruthers | CC BY-SA 2.5 | added 1147 characters in body |
| Sep 22, 2008 at 7:00 | history | answered | Chris Carruthers | CC BY-SA 2.5 |