java.util.concurrent.ConcurrentSkipListMap.doRemove()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(124)

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

ConcurrentSkipListMap.doRemove介绍

[英]Main deletion method. Locates node, nulls value, appends a deletion marker, unlinks predecessor, removes associated index nodes, and possibly reduces head index level. Index nodes are cleared out simply by calling findPredecessor. which unlinks indexes to deleted nodes found along path to key, which will include the indexes to this node. This is done unconditionally. We can't check beforehand whether there are index nodes because it might be the case that some or all indexes hadn't been inserted yet for this node during initial search for it, and we'd like to ensure lack of garbage retention, so must call to be sure.
[中]主删除方法。定位节点,为空值,附加删除标记,取消前一个节点的链接,删除关联的索引节点,并可能降低头索引级别。只需调用findPredecessor即可清除索引节点。它将索引与沿键路径找到的已删除节点解除链接,该路径将包括指向此节点的索引。这是无条件的。我们无法事先检查是否存在索引节点,因为可能在初始搜索该节点时,尚未插入该节点的部分或所有索引,并且我们希望确保没有垃圾保留,因此必须调用以确保。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Removes the mapping for the specified key from this map if present.
 *
 * @param  key key for which mapping should be removed
 * @return the previous value associated with the specified key, or
 *         {@code null} if there was no mapping for the key
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  return doRemove(key, null);
}

代码示例来源:origin: robovm/robovm

/**
 * {@inheritDoc}
 *
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  if (key == null)
    throw new NullPointerException();
  if (value == null)
    return false;
  return doRemove(key, value) != null;
}

代码示例来源:origin: robovm/robovm

private Map.Entry<K,V> removeLowest() {
  for (;;) {
    Node<K,V> n = loNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: robovm/robovm

private Map.Entry<K,V> removeHighest() {
  for (;;) {
    Node<K,V> n = hiNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Removes the mapping for the specified key from this map if present.
 *
 * @param  key key for which mapping should be removed
 * @return the previous value associated with the specified key, or
 *         <tt>null</tt> if there was no mapping for the key
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  return doRemove(key, null);
}

代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166

/**
 * Removes the mapping for the specified key from this map if present.
 *
 * @param  key key for which mapping should be removed
 * @return the previous value associated with the specified key, or
 *         <tt>null</tt> if there was no mapping for the key
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  return doRemove(key, null);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Removes the mapping for the specified key from this map if present.
 *
 * @param  key key for which mapping should be removed
 * @return the previous value associated with the specified key, or
 *         {@code null} if there was no mapping for the key
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  return doRemove(key, null);
}

代码示例来源:origin: MobiVM/robovm

/**
 * Removes the mapping for the specified key from this map if present.
 *
 * @param  key key for which mapping should be removed
 * @return the previous value associated with the specified key, or
 *         {@code null} if there was no mapping for the key
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  return doRemove(key, null);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Removes the mapping for the specified key from this map if present.
 *
 * @param  key key for which mapping should be removed
 * @return the previous value associated with the specified key, or
 *         {@code null} if there was no mapping for the key
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  return doRemove(key, null);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Removes the mapping for the specified key from this map if present.
 *
 * @param  key key for which mapping should be removed
 * @return the previous value associated with the specified key, or
 *         {@code null} if there was no mapping for the key
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  return doRemove(key, null);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * {@inheritDoc}
 *
 * @throws ClassCastException if the specified key cannot be compared
 *         with the keys currently in the map
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  if (key == null)
    throw new NullPointerException();
  if (value == null)
    return false;
  return doRemove(key, value) != null;
}

代码示例来源:origin: ibinti/bugvm

private Map.Entry<K,V> removeLowest() {
  for (;;) {
    Node<K,V> n = loNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: MobiVM/robovm

private Map.Entry<K,V> removeLowest() {
  for (;;) {
    Node<K,V> n = loNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: MobiVM/robovm

private Map.Entry<K,V> removeHighest() {
  for (;;) {
    Node<K,V> n = hiNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

private Map.Entry<K,V> removeHighest() {
  for (;;) {
    Node<K,V> n = hiNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: ibinti/bugvm

private Map.Entry<K,V> removeHighest() {
  for (;;) {
    Node<K,V> n = hiNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

private Map.Entry<K,V> removeHighest() {
  for (;;) {
    Node<K,V> n = hiNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private Map.Entry<K,V> removeHighest() {
  for (;;) {
    Node<K,V> n = hiNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

private Map.Entry<K,V> removeLowest() {
  for (;;) {
    Node<K,V> n = loNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

private Map.Entry<K,V> removeHighest() {
  for (;;) {
    Node<K,V> n = hiNode();
    if (n == null)
      return null;
    K k = n.key;
    if (!inBounds(k))
      return null;
    V v = m.doRemove(k, null);
    if (v != null)
      return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
  }
}

相关文章

ConcurrentSkipListMap类方法