我经常听说这些方法(Object.hashCode和System.identityHashCode)返回对象的地址,或者从地址快速计算的东西; 但我也很确定垃圾收集器会移动并压缩物体.由于哈希码不能改变,这就出现了问题.我知道这不是人们日常工作需要知道的事情,但我想了解内部情况.那么,有谁知道这是如何在Java中实现的?或.NET,因为它们可能类似.
Object.hashCode
System.identityHashCode
java garbage-collection internals hashcode object-identity
garbage-collection ×1
hashcode ×1
internals ×1
java ×1
object-identity ×1