Kon*_*che 40
取自Integer.class
源代码:
/**
* Returns a hash code for this {@code Integer}.
*
* @return a hash code value for this object, equal to the
* primitive {@code int} value represented by this
* {@code Integer} object.
*/
public int hashCode() {
return value;
}
Run Code Online (Sandbox Code Playgroud)
value
整数的值在哪里.
Mar*_*nik 37
对于hashCode
一个int
最自然的选择是使用它int
自己.一个更好的问题是什么用于hashCode
a,long
因为它不适合int
-sized哈希码.这个以及所有hashCode
相关问题的最佳来源是Effective Java.