本文整理了Java中com.carrotsearch.hppc.LongHashSet.shiftConflictingKeys()
方法的一些代码示例,展示了LongHashSet.shiftConflictingKeys()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LongHashSet.shiftConflictingKeys()
方法的具体详情如下:
包路径:com.carrotsearch.hppc.LongHashSet
类名称:LongHashSet
方法名:shiftConflictingKeys
[英]Shift all the slot-conflicting keys allocated to (and including) slot
.
[中]将分配给(包括)slot
的所有插槽冲突密钥移位。
代码示例来源: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
/**
* {@inheritDoc}
*/
@Override
public int removeAll(LongPredicate predicate) {
int before = size();
if (hasEmptyKey) {
if (predicate.apply(0L)) {
hasEmptyKey = false;
}
}
final long[] keys = this.keys;
for (int slot = 0, max = this.mask; slot <= max;) {
long existing;
if (!((existing = keys[slot]) == 0)) {
if (predicate.apply(existing)) {
shiftConflictingKeys(slot);
continue; // Repeat the check for the same slot i (shifted).
}
}
slot++;
}
return before - size();
}
代码示例来源: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
/**
* {@inheritDoc}
*/
@Override
public int removeAll(LongPredicate predicate) {
int before = size();
if (hasEmptyKey) {
if (predicate.apply(0L)) {
hasEmptyKey = false;
}
}
final long[] keys = this.keys;
for (int slot = 0, max = this.mask; slot <= max;) {
long existing;
if (!((existing = keys[slot]) == 0)) {
if (predicate.apply(existing)) {
shiftConflictingKeys(slot);
continue; // Repeat the check for the same slot i (shifted).
}
}
slot++;
}
return before - size();
}
内容来源于网络,如有侵权,请联系作者删除!