com.carrotsearch.hppc.ObjectIntHashMap.shiftConflictingKeys()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(74)

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

ObjectIntHashMap.shiftConflictingKeys介绍

[英]Shift all the slot-conflicting keys and values allocated to (and including) slot.
[中]

代码示例

代码示例来源:origin: carrotsearch/hppc

/**
 * {@inheritDoc}
 */
@Override
public int remove(KType key) {
 final int mask = this.mask;
 if (((key) == null)) {
  hasEmptyKey = false;
  int previousValue =  values[mask + 1];
  values[mask + 1] = 0;
  return previousValue;
 } else {
  final KType[] keys = (KType[]) this.keys;
  int slot = hashKey(key) & mask;
  KType existing;
  while (!((existing = keys[slot]) == null)) {
   if (this.equals(existing,  key)) {
    final int previousValue =  values[slot];
    shiftConflictingKeys(slot);
    return previousValue;
   }
   slot = (slot + 1) & mask;
  }
  return 0;
 }
}

代码示例来源:origin: carrotsearch/hppc

/**
 * {@inheritDoc}
 */
@Override
public int removeAll(ObjectPredicate<? super KType> predicate) {
 final int before = size();
 if (hasEmptyKey) {
  if (predicate.apply(null)) {
   hasEmptyKey = false;
   values[mask + 1] = 0;
  }
 }
 final KType[] keys = (KType[]) this.keys;
 for (int slot = 0, max = this.mask; slot <= max;) {
  KType existing;
  if (!((existing = keys[slot]) == null) &&
    predicate.apply(existing)) {
   // Shift, do not increment slot.
   shiftConflictingKeys(slot);
  } else {
   slot++;
  }
 }
 return before - size();
}

代码示例来源:origin: carrotsearch/hppc

/**
 * {@inheritDoc}
 */
@Override
public int removeAll(ObjectIntPredicate<? super KType> predicate) {
 final int before = size();
 final int mask = this.mask;
 if (hasEmptyKey) {
  if (predicate.apply(null,  values[mask + 1])) {
   hasEmptyKey = false;
   values[mask + 1] = 0;
  }
 }
 final KType[] keys = (KType[]) this.keys;
 final int[] values =  this.values;
 for (int slot = 0; slot <= mask;) {
  KType existing;
  if (!((existing = keys[slot]) == null) && 
    predicate.apply(existing, values[slot])) {
   // Shift, do not increment slot.
   shiftConflictingKeys(slot);
  } else {
   slot++;
  }
 }
 return before - size();    
}

代码示例来源:origin: carrotsearch/hppc

if (!((existing = keys[slot]) == null) && other.contains(existing)) {
 shiftConflictingKeys(slot);
} else {
 slot++;

代码示例来源:origin: harbby/presto-connectors

/**
 * {@inheritDoc}
 */
@Override
public int remove(KType key) {
 final int mask = this.mask;
 if (((key) == null)) {
  hasEmptyKey = false;
  int previousValue =  values[mask + 1];
  values[mask + 1] = 0;
  return previousValue;
 } else {
  final KType[] keys = (KType[]) this.keys;
  int slot = hashKey(key) & mask;
  KType existing;
  while (!((existing = keys[slot]) == null)) {
   if (this.equals(existing,  key)) {
    final int previousValue =  values[slot];
    shiftConflictingKeys(slot);
    return previousValue;
   }
   slot = (slot + 1) & mask;
  }
  return 0;
 }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * {@inheritDoc}
 */
@Override
public int removeAll(ObjectPredicate<? super KType> predicate) {
 final int before = size();
 if (hasEmptyKey) {
  if (predicate.apply(null)) {
   hasEmptyKey = false;
   values[mask + 1] = 0;
  }
 }
 final KType[] keys = (KType[]) this.keys;
 for (int slot = 0, max = this.mask; slot <= max;) {
  KType existing;
  if (!((existing = keys[slot]) == null) &&
    predicate.apply(existing)) {
   // Shift, do not increment slot.
   shiftConflictingKeys(slot);
  } else {
   slot++;
  }
 }
 return before - size();
}

代码示例来源:origin: harbby/presto-connectors

/**
 * {@inheritDoc}
 */
@Override
public int removeAll(ObjectIntPredicate<? super KType> predicate) {
 final int before = size();
 final int mask = this.mask;
 if (hasEmptyKey) {
  if (predicate.apply(null,  values[mask + 1])) {
   hasEmptyKey = false;
   values[mask + 1] = 0;
  }
 }
 final KType[] keys = (KType[]) this.keys;
 final int[] values =  this.values;
 for (int slot = 0; slot <= mask;) {
  KType existing;
  if (!((existing = keys[slot]) == null) && 
    predicate.apply(existing, values[slot])) {
   // Shift, do not increment slot.
   shiftConflictingKeys(slot);
  } else {
   slot++;
  }
 }
 return before - size();    
}

代码示例来源:origin: harbby/presto-connectors

if (!((existing = keys[slot]) == null) && other.contains(existing)) {
 shiftConflictingKeys(slot);
} else {
 slot++;

相关文章