If Java's garbage collector moves objects, what is Object.hashCode and System.identityHashCode?

后端 未结 3 1640
面向向阳花
面向向阳花 2021-02-02 07:18

I\'ve often heard that these methods (Object.hashCode and System.identityHashCode) return the address of the object, or something computed quickly from

3条回答
  •  -上瘾入骨i
    2021-02-02 08:00

    In .net the getHash() method will be impacted by the GC and therefore its recommended that developers use their own hash implementations. I cant find the link to the internal implementation at them moment. I will post it later if I find it..

    Found the link... This question was answered here

提交回复
热议问题