Package org.pcollections
Class HashPMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.pcollections.HashPMap<K,V>
- Type Parameters:
K
-V
-
- All Implemented Interfaces:
Serializable
,Map<K,
,V> PMap<K,
V>
A persistent map from non-null keys to non-null values.
This map uses a given integer map to map hashcodes to lists of elements with the same hashcode. Thus if all elements have the same hashcode, performance is reduced to that of an association list.
This implementation is thread-safe (assuming Java's AbstractMap and AbstractSet are thread-safe), although its iterators may not be.
- See Also:
-
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> -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Object key) static <K,
V> HashPMap<K, V> entrySet()
minusAll
(Collection<?> keys) int
size()
Methods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, values
-
Method Details
-
empty
- Type Parameters:
K
-V
-- Parameters:
intMap
-- Returns:
- a map backed by an empty version of intMap, i.e. backed by intMap.minusAll(intMap.keySet())
-
entrySet
-
size
public int size() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
get
-
plusAll
-
minusAll
-
plus
-
minus
-