我在 HashMap.java 中看到了以下代码。
h ^= k.hashCode();
// This function ensures that hashCodes that differ only by
// constant multiples at each bit position have a bounded
// number of collisions (approximately 8 at default load factor).
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
一些随机输入产生类似于加法的输出,但以下代码导致 0
int p = 10;
p ^= 10;
System.out.println("_______ " + p);