Package com.landawn.abacus.util
Class ObjectPool<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
com.landawn.abacus.util.ObjectPool<K,V>
- Type Parameters:
K
- the key typeV
- the value type
- All Implemented Interfaces:
Map<K,
V>
It's is a multiple-thread safety map with fixed size. it's designed for frequent get and few add/remove operation
with a few limited keys.
- Since:
- 0.8
- Author:
- Haiyang Li
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear.boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
isEmpty()
Checks if is empty.keySet()
void
int
size()
values()
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ObjectPool
public ObjectPool(int capacity) - Parameters:
capacity
-
-
-
Method Details
-
get
-
put
-
putAll
-
remove
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V> - Parameters:
key
-- Returns:
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V> - Overrides:
containsValue
in classAbstractMap<K,
V> - Parameters:
value
-- Returns:
-
keySet
-
values
-
entrySet
-
size
public int size() -
isEmpty
public boolean isEmpty()Checks if is empty. -
clear
public void clear()Clear.
-