what should be the return type of the hashCode()
Posted
by subhashis
on Stack Overflow
See other posts from Stack Overflow
or by subhashis
Published on 2010-04-22T07:59:34Z
Indexed on
2010/04/22
8:03 UTC
Read the original article
Hit count: 215
The signature of the hashCode() method is
public int hashCode(){
return x;
}
in this case x must be an int(primitive) but plz can anyone explain it to me that the number which the hashCode() returns must be a prime number, even number...etc or there is no specification ? the reason behind i am asking this question is i have seen it in different ids the auto generated code always returns a prime number, so i need to know why?
thanks in advance
© Stack Overflow or respective owner