public class ConcurrentReferenceHashMap<K,V> extends AbstractMap<K,V> implements ConcurrentMap<K,V>
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ConcurrentReferenceHashMap.ReferenceType
Various reference types supported by this map.
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| 构造器和说明 |
|---|
ConcurrentReferenceHashMap()
Create a new
ConcurrentReferenceHashMap instance. |
ConcurrentReferenceHashMap(int initialCapacity)
Create a new
ConcurrentReferenceHashMap instance. |
ConcurrentReferenceHashMap(int initialCapacity,
ConcurrentReferenceHashMap.ReferenceType referenceType)
Create a new
ConcurrentReferenceHashMap instance. |
ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor)
Create a new
ConcurrentReferenceHashMap instance. |
ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel)
Create a new
ConcurrentReferenceHashMap instance. |
ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel,
ConcurrentReferenceHashMap.ReferenceType referenceType)
Create a new
ConcurrentReferenceHashMap instance. |
ConcurrentReferenceHashMap(int initialCapacity,
int concurrencyLevel)
Create a new
ConcurrentReferenceHashMap instance. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear() |
boolean |
containsKey(Object key) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
V |
getOrDefault(Object key,
V defaultValue) |
boolean |
isEmpty() |
static boolean |
nullSafeEquals(Object o1,
Object o2) |
static int |
nullSafeHashCode(Object obj) |
void |
purgeUnreferencedEntries()
Remove any entries that have been garbage collected and are no longer referenced.
|
V |
put(K key,
V value) |
V |
putIfAbsent(K key,
V value) |
V |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
int |
size() |
containsValue, equals, hashCode, keySet, putAll, toString, valuescompute, computeIfAbsent, computeIfPresent, forEach, merge, replaceAllpublic ConcurrentReferenceHashMap()
ConcurrentReferenceHashMap instance.public ConcurrentReferenceHashMap(int initialCapacity)
ConcurrentReferenceHashMap instance.initialCapacity - the initial capacity of the mappublic ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor)
ConcurrentReferenceHashMap instance.initialCapacity - the initial capacity of the maploadFactor - the load factor. When the average number of references per table
exceeds this value resize will be attemptedpublic ConcurrentReferenceHashMap(int initialCapacity,
int concurrencyLevel)
ConcurrentReferenceHashMap instance.initialCapacity - the initial capacity of the mapconcurrencyLevel - the expected number of threads that will concurrently
write to the mappublic ConcurrentReferenceHashMap(int initialCapacity,
ConcurrentReferenceHashMap.ReferenceType referenceType)
ConcurrentReferenceHashMap instance.initialCapacity - the initial capacity of the mapreferenceType - the reference type used for entries (soft or weak)public ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel)
ConcurrentReferenceHashMap instance.initialCapacity - the initial capacity of the maploadFactor - the load factor. When the average number of references per
table exceeds this value, resize will be attempted.concurrencyLevel - the expected number of threads that will concurrently
write to the mappublic ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel,
ConcurrentReferenceHashMap.ReferenceType referenceType)
ConcurrentReferenceHashMap instance.initialCapacity - the initial capacity of the maploadFactor - the load factor. When the average number of references per
table exceeds this value, resize will be attempted.concurrencyLevel - the expected number of threads that will concurrently
write to the mapreferenceType - the reference type used for entries (soft or weak)public V getOrDefault(Object key, V defaultValue)
getOrDefault 在接口中 ConcurrentMap<K,V>getOrDefault 在接口中 Map<K,V>public boolean containsKey(Object key)
containsKey 在接口中 Map<K,V>containsKey 在类中 AbstractMap<K,V>public V putIfAbsent(K key, V value)
putIfAbsent 在接口中 ConcurrentMap<K,V>putIfAbsent 在接口中 Map<K,V>public void purgeUnreferencedEntries()
public static int nullSafeHashCode(Object obj)
Copyright © 2021. All rights reserved.