Issue 625: use (even) better primes for hashcodes

This commit is contained in:
Roel Spilker
2014-01-19 21:49:35 +01:00
parent 2ab6cc809d
commit 14cc545276
34 changed files with 82 additions and 65 deletions
@@ -24,7 +24,7 @@ public class EqualsAndHashCodeExample {
}
@Override public int hashCode() {
final int PRIME = 277;
final int PRIME = 59;
int result = 1;
final long temp1 = Double.doubleToLongBits(this.score);
result = (result*PRIME) + (this.name == null ? 0 : this.name.hashCode());
@@ -57,7 +57,7 @@ public class EqualsAndHashCodeExample {
}
@Override public int hashCode() {
final int PRIME = 277;
final int PRIME = 59;
int result = 1;
result = (result*PRIME) + super.hashCode();
result = (result*PRIME) + this.width;