Class HashPMap<K,V>
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 ClassesNested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(Object key) static <K,V> HashPMap <K, V> entrySet()getEntries(int hash) / PRIVATE UTILITIES ////private static <K,V> int keyIndexIn(PSequence<Map.Entry<K, V>> entries, Object key) / PRIVATE STATIC UTILITIES ////minusAll(Collection<?> keys) / IMPLEMENTED METHODS OF PMap////intsize()/ OVERRIDDEN METHODS FROM AbstractMap ////Methods inherited from class AbstractUnmodifiableMap
clear, compute, computeIfAbsent, computeIfPresent, merge, put, putAll, putIfAbsent, remove, replace, replaceAllMethods inherited from class AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, toString, valuesMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, values
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
intMap
-
size
private final int size -
entrySet
-
-
Constructor Details
-
HashPMap
-
-
Method Details
-
empty
-
entrySet
-
size
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
get
-
plusAll
-
minusAll
-
plus
-
minus
-
getEntries
-
keyIndexIn
-