本文整理了Java中com.carrotsearch.hppc.LongHashSet.hashKey()
方法的一些代码示例,展示了LongHashSet.hashKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LongHashSet.hashKey()
方法的具体详情如下:
包路径:com.carrotsearch.hppc.LongHashSet
类名称:LongHashSet
方法名:hashKey
[英]Returns a hash code for the given key. The default implementation mixes the hash of the key with #keyMixerto differentiate hash order of keys between hash containers. Helps alleviate problems resulting from linear conflict resolution in open addressing. The output from this function should evenly distribute keys across the entire integer range.
[中]
代码示例来源:origin: carrotsearch/hppc
/**
* {@inheritDoc}
*/
@Override
public boolean contains(long key) {
if (((key) == 0)) {
return hasEmptyKey;
} else {
final long [] keys = this.keys;
final int mask = this.mask;
int slot = hashKey(key) & mask;
long existing;
while (!((existing = keys[slot]) == 0)) {
if (((existing) == ( key))) {
return true;
}
slot = (slot + 1) & mask;
}
return false;
}
}
代码示例来源:origin: carrotsearch/hppc
final int idealSlot = hashKey(existing);
final int shift = (slot - idealSlot) & mask;
if (shift >= distance) {
代码示例来源:origin: carrotsearch/hppc
} else {
final long[] keys = this.keys;
int slot = hashKey(key) & mask;
代码示例来源:origin: carrotsearch/hppc
/**
* Rehash from old buffers to new buffers.
*/
protected void rehash(long[] fromKeys) {
assert HashContainers.checkPowerOfTwo(fromKeys.length - 1);
// Rehash all stored keys into the new buffers.
final long[] keys = this.keys;
final int mask = this.mask;
long existing;
for (int i = fromKeys.length - 1; --i >= 0;) {
if (!((existing = fromKeys[i]) == 0)) {
int slot = hashKey(existing) & mask;
while (!((keys[slot]) == 0)) {
slot = (slot + 1) & mask;
}
keys[slot] = existing;
}
}
}
代码示例来源:origin: carrotsearch/hppc
/**
* An alias for the (preferred) {@link #removeAll}.
*/
public boolean remove(long key) {
if (((key) == 0)) {
boolean hadEmptyKey = hasEmptyKey;
hasEmptyKey = false;
return hadEmptyKey;
} else {
final long [] keys = this.keys;
final int mask = this.mask;
int slot = hashKey(key) & mask;
long existing;
while (!((existing = keys[slot]) == 0)) {
if (((existing) == ( key))) {
shiftConflictingKeys(slot);
return true;
}
slot = (slot + 1) & mask;
}
return false;
}
}
代码示例来源:origin: carrotsearch/hppc
final long [] keys = this.keys;
final int mask = this.mask;
int slot = hashKey(key) & mask;
代码示例来源:origin: harbby/presto-connectors
/**
* {@inheritDoc}
*/
@Override
public boolean contains(long key) {
if (((key) == 0)) {
return hasEmptyKey;
} else {
final long [] keys = this.keys;
final int mask = this.mask;
int slot = hashKey(key) & mask;
long existing;
while (!((existing = keys[slot]) == 0)) {
if (((existing) == ( key))) {
return true;
}
slot = (slot + 1) & mask;
}
return false;
}
}
代码示例来源:origin: harbby/presto-connectors
final int idealSlot = hashKey(existing);
final int shift = (slot - idealSlot) & mask;
if (shift >= distance) {
代码示例来源:origin: harbby/presto-connectors
} else {
final long[] keys = this.keys;
int slot = hashKey(key) & mask;
代码示例来源:origin: harbby/presto-connectors
/**
* Rehash from old buffers to new buffers.
*/
protected void rehash(long[] fromKeys) {
assert HashContainers.checkPowerOfTwo(fromKeys.length - 1);
// Rehash all stored keys into the new buffers.
final long[] keys = this.keys;
final int mask = this.mask;
long existing;
for (int i = fromKeys.length - 1; --i >= 0;) {
if (!((existing = fromKeys[i]) == 0)) {
int slot = hashKey(existing) & mask;
while (!((keys[slot]) == 0)) {
slot = (slot + 1) & mask;
}
keys[slot] = existing;
}
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* An alias for the (preferred) {@link #removeAll}.
*/
public boolean remove(long key) {
if (((key) == 0)) {
boolean hadEmptyKey = hasEmptyKey;
hasEmptyKey = false;
return hadEmptyKey;
} else {
final long [] keys = this.keys;
final int mask = this.mask;
int slot = hashKey(key) & mask;
long existing;
while (!((existing = keys[slot]) == 0)) {
if (((existing) == ( key))) {
shiftConflictingKeys(slot);
return true;
}
slot = (slot + 1) & mask;
}
return false;
}
}
代码示例来源:origin: harbby/presto-connectors
final long [] keys = this.keys;
final int mask = this.mask;
int slot = hashKey(key) & mask;
内容来源于网络,如有侵权,请联系作者删除!