Why was hashcode designed to return int [duplicate]
问题 This question already has answers here : Why Object#hashCode() returns int instead of long (3 answers) Closed 6 years ago . It seems like a hashcode always returns an int. Now this appears to be a limiting factor due to IntMax. Now one can argue that such we would never have so many objects, as it would cause heap overflow etc. But if we chose double instead of int then we could guarantee with a much larger extent that hashcode wont be unique for distinct objects ? 回答1: Hashcodes don't need