public class PersistentHashMap<K,V> extends UnmodMap.AbstractUnmodMap<K,V> implements ImUnsortedMap<K,V>, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
PersistentHashMap.MutableHashMap<K,V> |
UnmodMap.AbstractUnmodMap<K,V>, UnmodMap.UnEntry<K,V>
UnmodIterable.AbstractUnmodIterable<T>
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) |
Equator<K> |
equator()
Returns the Equator used by this map for equals comparisons and hashCodes
|
PersistentHashMap<K,V> |
immutable()
Returns a immutable version of this (maybe) mutable map.
|
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 immutable 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 iterable.
|
PersistentHashMap<K,V> |
without(K key)
Returns a new map with the given key/value removed
|
equals
hashCode, toString
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
assoc, keySet
containsKey, entrySet, get, getOrElse
clear, compute, computeIfAbsent, computeIfPresent, containsValue, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, values
equals, forEach, getOrDefault, hashCode
concat, drop, filter, flatMap, foldLeft, foldLeft, hash, hashCode, head, map, precat, take, takeWhile, toString
forEach, spliterator
toImList, toImMap, toImSet, toImSortedMap, toImSortedSet, toMutableList, toMutableMap, 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 ImUnsortedMap<K,V>
public PersistentHashMap<K,V> assoc(K key, V val)
ImUnsortedMap
public PersistentHashMap.MutableHashMap<K,V> mutable()
ImUnsortedMap
mutable
in interface ImUnsortedMap<K,V>
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 final PersistentHashMap<K,V> immutable()
ImUnsortedMap
immutable
in interface ImUnsortedMap<K,V>
public int size()
public PersistentHashMap<K,V> without(K key)
ImUnsortedMap
Copyright © 2017. All rights reserved.