java.util.Collections.secondaryIdentityHash()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中java.util.Collections.secondaryIdentityHash()方法的一些代码示例,展示了Collections.secondaryIdentityHash()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collections.secondaryIdentityHash()方法的具体详情如下:
包路径:java.util.Collections
类名称:Collections
方法名:secondaryIdentityHash

Collections.secondaryIdentityHash介绍

[英]Computes an identity hash code and applies a supplemental hash function to defend against poor quality hash functions. This is critical because identity hash codes are currently implemented as object addresses, which will have been aligned by the underlying memory allocator causing all hash codes to have the same bottom bits.
[中]计算标识散列码并应用补充散列函数来防御低质量的散列函数。这是至关重要的,因为标识哈希代码当前实现为对象地址,而对象地址将由底层内存分配器对齐,从而使所有哈希代码具有相同的底部位。

代码示例

代码示例来源:origin: robovm/robovm

private int getModuloHash(Object key, int length) {
  return ((Collections.secondaryIdentityHash(key) & 0x7FFFFFFF) % (length / 2)) * 2;
}

代码示例来源:origin: com.jtransc/jtransc-rt

private int getModuloHash(Object key, int length) {
  return ((Collections.secondaryIdentityHash(key) & 0x7FFFFFFF) % (length / 2)) * 2;
}

代码示例来源:origin: ibinti/bugvm

private int getModuloHash(Object key, int length) {
  return ((Collections.secondaryIdentityHash(key) & 0x7FFFFFFF) % (length / 2)) * 2;
}

代码示例来源:origin: MobiVM/robovm

private int getModuloHash(Object key, int length) {
  return ((Collections.secondaryIdentityHash(key) & 0x7FFFFFFF) % (length / 2)) * 2;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private int getModuloHash(Object key, int length) {
  return ((Collections.secondaryIdentityHash(key) & 0x7FFFFFFF) % (length / 2)) * 2;
}

代码示例来源:origin: com.gluonhq/robovm-rt

private int getModuloHash(Object key, int length) {
  return ((Collections.secondaryIdentityHash(key) & 0x7FFFFFFF) % (length / 2)) * 2;
}

代码示例来源:origin: com.bugvm/bugvm-rt

private int getModuloHash(Object key, int length) {
  return ((Collections.secondaryIdentityHash(key) & 0x7FFFFFFF) % (length / 2)) * 2;
}

代码示例来源:origin: FlexoVM/flexovm

private int getModuloHash(Object key, int length) {
  return ((Collections.secondaryIdentityHash(key) & 0x7FFFFFFF) % (length / 2)) * 2;
}

相关文章

Collections类方法