public class ConcurrentReferenceHashMap<K,V> extends AbstractMap<K,V> implements ConcurrentMap<K,V>, Serializable
copy with spring key value 可以为null
Modifier and Type | Class and Description |
---|---|
protected static class |
ConcurrentReferenceHashMap.Entry<K,V> |
protected static interface |
ConcurrentReferenceHashMap.Reference<K,V> |
protected class |
ConcurrentReferenceHashMap.ReferenceManager |
static class |
ConcurrentReferenceHashMap.ReferenceType |
protected static class |
ConcurrentReferenceHashMap.Restructure |
protected class |
ConcurrentReferenceHashMap.Segment |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
ConcurrentReferenceHashMap() |
ConcurrentReferenceHashMap(ConcurrentReferenceHashMap.ReferenceType referenceType) |
ConcurrentReferenceHashMap(int initialCapacity) |
ConcurrentReferenceHashMap(int initialCapacity,
ConcurrentReferenceHashMap.ReferenceType referenceType) |
ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor) |
ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel) |
ConcurrentReferenceHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel,
ConcurrentReferenceHashMap.ReferenceType referenceType) |
ConcurrentReferenceHashMap(int initialCapacity,
int concurrencyLevel) |
Modifier and Type | Method and Description |
---|---|
protected static int |
calculateShift(int minimumValue,
int maximumValue) |
void |
clear() |
boolean |
containsKey(Object key) |
static <K,V> ConcurrentReferenceHashMap<K,V> |
create() |
static <K,V> ConcurrentReferenceHashMap<K,V> |
create(ConcurrentReferenceHashMap.ReferenceType referenceType) |
protected ConcurrentReferenceHashMap.ReferenceManager |
createReferenceManager() |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
protected int |
getHash(Object o) |
protected float |
getLoadFactor() |
protected ConcurrentReferenceHashMap.Reference<K,V> |
getReference(Object key,
ConcurrentReferenceHashMap.Restructure restructure) |
protected ConcurrentReferenceHashMap.Segment |
getSegment(int index) |
protected int |
getSegmentsSize() |
void |
purgeUnreferencedEntries()
删除所有已经被垃圾收集并且不再被引用的条目
在正常情况下,垃圾收集的条目会被自动清除
因为条目会从映射中添加或删除
此方法可用于强制清除 并且在频繁读取映射但更新较少的情况下非常有用
|
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() |
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
public ConcurrentReferenceHashMap()
public ConcurrentReferenceHashMap(ConcurrentReferenceHashMap.ReferenceType referenceType)
public ConcurrentReferenceHashMap(int initialCapacity)
public ConcurrentReferenceHashMap(int initialCapacity, float loadFactor)
public ConcurrentReferenceHashMap(int initialCapacity, int concurrencyLevel)
public ConcurrentReferenceHashMap(int initialCapacity, ConcurrentReferenceHashMap.ReferenceType referenceType)
public ConcurrentReferenceHashMap(int initialCapacity, float loadFactor, int concurrencyLevel)
public ConcurrentReferenceHashMap(int initialCapacity, float loadFactor, int concurrencyLevel, ConcurrentReferenceHashMap.ReferenceType referenceType)
public static <K,V> ConcurrentReferenceHashMap<K,V> create()
public static <K,V> ConcurrentReferenceHashMap<K,V> create(ConcurrentReferenceHashMap.ReferenceType referenceType)
protected final float getLoadFactor()
protected final int getSegmentsSize()
protected final ConcurrentReferenceHashMap.Segment getSegment(int index)
protected ConcurrentReferenceHashMap.ReferenceManager createReferenceManager()
protected int getHash(Object o)
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class AbstractMap<K,V>
protected final ConcurrentReferenceHashMap.Reference<K,V> getReference(Object key, ConcurrentReferenceHashMap.Restructure restructure)
public V putIfAbsent(K key, V value)
putIfAbsent
in interface ConcurrentMap<K,V>
putIfAbsent
in interface Map<K,V>
public void clear()
public void purgeUnreferencedEntries()
public int size()
protected static int calculateShift(int minimumValue, int maximumValue)
Copyright © 2024. All rights reserved.