Why use a prime number in hashCode?
I was just wondering why is that primes are used in a class’s hashCode() method? For example, when using Eclipse to generate my hashCode() method there is always the prime number 31 used: public int hashCode() { final int prime = 31; //… } References: Here is a good primer on Hashcode and article on … Read more