public class PersistentHashMap<K,V> extends AbstractUnmodMap<K,V> implements ImMap<K,V>, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
PersistentHashMap.MutableHashMap<K,V> |
UnmodMap.UnEntry<K,V>
Modifier and Type | Field and Description |
---|---|
static PersistentHashMap<Object,Object> |
EMPTY |
Modifier and Type | Method and Description |
---|---|
PersistentHashMap<K,V> |
assoc(K key,
V val)
Returns a new map with the given key/value added
|
static <K,V> PersistentHashMap<K,V> |
empty() |
static <K,V> PersistentHashMap<K,V> |
empty(Equator<K> e) |
static <K,V> PersistentHashMap.MutableHashMap<K,V> |
emptyMutable()
Works around some type inference limitations of Java 8.
|
static <K,V> PersistentHashMap.MutableHashMap<K,V> |
emptyMutable(Equator<K> e)
Works around some type inference limitations of Java 8.
|
Option<UnmodMap.UnEntry<K,V>> |
entry(K key)
Returns an option of the key/value pair associated with this key
|
Equator<K> |
equator()
Returns the Equator used by this map for equals comparisons and hashCodes
|
UnmodIterator<UnmodMap.UnEntry<K,V>> |
iterator()
A one-time use, mutable, not-thread-safe way to get each value of the underling collection in
turn.
|
PersistentHashMap.MutableHashMap<K,V> |
mutable()
Returns a mutable version of this mutable map.
|
static <K,V> PersistentHashMap<K,V> |
of(Iterable<Map.Entry<K,V>> kvPairs)
Returns a new PersistentHashMap of the given keys and their paired values.
|
static <K,V> PersistentHashMap<K,V> |
ofEq(Equator<K> eq,
Iterable<Map.Entry<K,V>> es)
Returns a new PersistentHashMap of the given keys and their paired values, skipping any null
Entries.
|
int |
size()
Returns the number of items in this collection or iterable.
|
PersistentHashMap<K,V> |
without(K key)
Returns a new map with the given key/value removed
|
equals
hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
containsKey, get, getOrElse
clear, compute, computeIfAbsent, computeIfPresent, containsValue, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, values
equals, forEach, getOrDefault, hashCode
concat, drop, dropWhile, filter, flatMap, fold, foldUntil, hash, head, map, precat, take, takeWhile, toString
forEach, spliterator
toImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutableList, toMutableMap, toMutableRrbt, toMutableSet, toMutableSortedMap, toMutableSortedSet
public static final PersistentHashMap<Object,Object> EMPTY
public static <K,V> PersistentHashMap<K,V> empty()
public static <K,V> PersistentHashMap.MutableHashMap<K,V> emptyMutable()
public static <K,V> PersistentHashMap<K,V> empty(Equator<K> e)
public static <K,V> PersistentHashMap.MutableHashMap<K,V> emptyMutable(Equator<K> e)
public static <K,V> PersistentHashMap<K,V> ofEq(Equator<K> eq, Iterable<Map.Entry<K,V>> es)
public static <K,V> PersistentHashMap<K,V> of(Iterable<Map.Entry<K,V>> kvPairs)
StaticImports.map(Map.Entry...)
. Use
the StaticImports.tup(Object, Object)
method to define key/value
pairs briefly and easily.kvPairs
- Key/value pairs (to go into the map). In the case of a duplicate key, later
values in the input list overwrite the earlier ones. The resulting map can contain zero or one
null key and any number of null values. Null k/v pairs will be silently ignored.public Equator<K> equator()
equator
in interface BaseUnsortedMap<K,V>
public PersistentHashMap<K,V> assoc(K key, V val)
ImMap
public PersistentHashMap.MutableHashMap<K,V> mutable()
ImMap
public Option<UnmodMap.UnEntry<K,V>> entry(K key)
BaseMap
public UnmodIterator<UnmodMap.UnEntry<K,V>> iterator()
UnmodIterable
iterator
in interface Iterable<UnmodMap.UnEntry<K,V>>
iterator
in interface UnmodIterable<UnmodMap.UnEntry<K,V>>
public int size()
Copyright © 2018. All rights reserved.