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

x33g5p2x  于2022-01-17 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(122)

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

ConcurrentHashMap.segmentForHash介绍

[英]Gets the segment for the given hash code.
[中]获取给定哈希代码的段。

代码示例

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  int hash = hash(key.hashCode());
  Segment<K,V> s;
  return value != null && (s = segmentForHash(hash)) != null &&
    s.remove(key, hash, value) != null;
}

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

/**
 * {@inheritDoc}
 *
 * @return the previous value associated with the specified key,
 *         or <tt>null</tt> if there was no mapping for the key
 * @throws NullPointerException if the specified key or value is null
 */
public V replace(K key, V value) {
  int hash = hash(key.hashCode());
  if (value == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s == null ? null : s.replace(key, hash, value);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if any of the arguments are null
 */
public boolean replace(K key, V oldValue, V newValue) {
  int hash = hash(key.hashCode());
  if (oldValue == null || newValue == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s != null && s.replace(key, hash, oldValue, newValue);
}

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

/**
 * Removes the key (and its corresponding value) from this map.
 * This method does nothing if the key is not in the map.
 *
 * @param  key the key that needs to be removed
 * @return the previous value associated with <tt>key</tt>, or
 *         <tt>null</tt> if there was no mapping for <tt>key</tt>
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  int hash = hash(key.hashCode());
  Segment<K,V> s = segmentForHash(hash);
  return s == null ? null : s.remove(key, hash, null);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if any of the arguments are null
 */
public boolean replace(K key, V oldValue, V newValue) {
  int hash = hash(key.hashCode());
  if (oldValue == null || newValue == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s != null && s.replace(key, hash, oldValue, newValue);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if any of the arguments are null
 */
public boolean replace(K key, V oldValue, V newValue) {
  int hash = hash(key.hashCode());
  if (oldValue == null || newValue == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s != null && s.replace(key, hash, oldValue, newValue);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if any of the arguments are null
 */
public boolean replace(K key, V oldValue, V newValue) {
  int hash = hash(key.hashCode());
  if (oldValue == null || newValue == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s != null && s.replace(key, hash, oldValue, newValue);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if any of the arguments are null
 */
public boolean replace(K key, V oldValue, V newValue) {
  int hash = hash(key.hashCode());
  if (oldValue == null || newValue == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s != null && s.replace(key, hash, oldValue, newValue);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  int hash = hash(key.hashCode());
  Segment<K,V> s;
  return value != null && (s = segmentForHash(hash)) != null &&
    s.remove(key, hash, value) != null;
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if any of the arguments are null
 */
public boolean replace(K key, V oldValue, V newValue) {
  int hash = hash(key.hashCode());
  if (oldValue == null || newValue == null)
    throw new NullPointerException();
  Segment<K, V> s = segmentForHash(hash);
  return s != null && s.replace(key, hash, oldValue, newValue);
}

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

/**
 * {@inheritDoc}
 *
 * @return the previous value associated with the specified key,
 *         or <tt>null</tt> if there was no mapping for the key
 * @throws NullPointerException if the specified key or value is null
 */
public V replace(K key, V value) {
  int hash = hash(key.hashCode());
  if (value == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s == null ? null : s.replace(key, hash, value);
}

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

/**
 * {@inheritDoc}
 *
 * @return the previous value associated with the specified key,
 * or <tt>null</tt> if there was no mapping for the key
 * @throws NullPointerException if the specified key or value is null
 */
public V replace(K key, V value) {
  int hash = hash(key.hashCode());
  if (value == null)
    throw new NullPointerException();
  Segment<K, V> s = segmentForHash(hash);
  return s == null ? null : s.replace(key, hash, value);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if any of the arguments are null
 */
public boolean replace(K key, V oldValue, V newValue) {
  int hash = hash(key.hashCode());
  if (oldValue == null || newValue == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s != null && s.replace(key, hash, oldValue, newValue);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  int hash = hash(key.hashCode());
  Segment<K,V> s;
  return value != null && (s = segmentForHash(hash)) != null &&
    s.remove(key, hash, value) != null;
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if any of the arguments are null
 */
public boolean replace(K key, V oldValue, V newValue) {
  int hash = hash(key.hashCode());
  if (oldValue == null || newValue == null)
    throw new NullPointerException();
  Segment<K,V> s = segmentForHash(hash);
  return s != null && s.replace(key, hash, oldValue, newValue);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  int hash = hash(key.hashCode());
  Segment<K,V> s;
  return value != null && (s = segmentForHash(hash)) != null &&
    s.remove(key, hash, value) != null;
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  int hash = hash(key.hashCode());
  Segment<K,V> s;
  return value != null && (s = segmentForHash(hash)) != null &&
    s.remove(key, hash, value) != null;
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  int hash = hash(key.hashCode());
  Segment<K,V> s;
  return value != null && (s = segmentForHash(hash)) != null &&
    s.remove(key, hash, value) != null;
}

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

/**
 * Removes the key (and its corresponding value) from this map.
 * This method does nothing if the key is not in the map.
 *
 * @param  key the key that needs to be removed
 * @return the previous value associated with <tt>key</tt>, or
 *         <tt>null</tt> if there was no mapping for <tt>key</tt>
 * @throws NullPointerException if the specified key is null
 */
public V remove(Object key) {
  int hash = hash(key.hashCode());
  Segment<K,V> s = segmentForHash(hash);
  return s == null ? null : s.remove(key, hash, null);
}

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

/**
 * {@inheritDoc}
 *
 * @throws NullPointerException if the specified key is null
 */
public boolean remove(Object key, Object value) {
  int hash = hash(key.hashCode());
  Segment<K, V> s;
  return value != null && (s = segmentForHash(hash)) != null &&
    s.remove(key, hash, value) != null;
}

相关文章

微信公众号

最新文章

更多