public class MapWithLock<K,V> extends ObjWithLock<Map<K,V>>
Constructor and Description |
---|
MapWithLock() |
MapWithLock(int initCapacity) |
MapWithLock(Map<K,V> map) |
MapWithLock(Map<K,V> map,
ReentrantReadWriteLock lock) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
clear
|
Map<K,V> |
copy() |
V |
get(K key) |
V |
put(K key,
V value) |
void |
putAll(Map<K,V> otherMap) |
V |
putIfAbsent(K key,
V value)
如果key值已经存在,则不会把新value put进去
如果key值不存在,此方法同put(key, value)
|
V |
remove(K key) |
int |
size() |
public MapWithLock()
public MapWithLock(int initCapacity)
public MapWithLock(Map<K,V> map, ReentrantReadWriteLock lock)
cacheMap
- lock
- Copyright © 2021. All rights reserved.