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自己.一个更好的问题是什么用于hashCodea,long因为它不适合int-sized哈希码.这个以及所有hashCode相关问题的最佳来源是Effective Java.
| 归档时间: |
|
| 查看次数: |
48395 次 |
| 最近记录: |