java.lang.Object
java.util.AbstractMap<K,V>
org.pcollections.AbstractUnmodifiableMap<K,V>
org.pcollections.HashPMap<K,V>
- Type Parameters:
K-V-
- All Implemented Interfaces:
Serializable,Map<K,,V> PMap<K,V>
public final class HashPMap<K,V>
extends AbstractUnmodifiableMap<K,V>
implements PMap<K,V>, Serializable
A persistent map from keys to values. Keys and values can be null.
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 TypeMethodDescriptionbooleancontainsKey(Object key) static <K,V> HashPMap<K, V> entrySet()minusAll(Collection<?> keys) intsize()Methods inherited from class org.pcollections.AbstractUnmodifiableMap
clear, compute, computeIfAbsent, computeIfPresent, merge, put, putAll, putIfAbsent, remove, replace, replaceAllMethods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
get
-
plusAll
-
minusAll
-
plus
-
minus
-