源代码如下:
这些位运算看得我一头雾水,能有谁解释一下原理吗?
static int hash(Object x) {
int h = x.hashCode(); h += ~(h << 9);
h ^= (h >>> 14);
h += (h << 4);
h ^= (h >>> 10);
return h;
}
这些位运算看得我一头雾水,能有谁解释一下原理吗?
static int hash(Object x) {
int h = x.hashCode(); h += ~(h << 9);
h ^= (h >>> 14);
h += (h << 4);
h ^= (h >>> 10);
return h;
}
这个值是对象的hashCode然后再进行左移右移并且进行非运算后得到的值.
靠,真不知道这数是个啥东西.