Package org.organicdesign.fp.collections
Class PersistentHashMap.MutHashMap<K,V>
- java.lang.Object
-
- org.organicdesign.fp.collections.AbstractUnmodIterable<UnmodMap.UnEntry<K,V>>
-
- org.organicdesign.fp.collections.AbstractUnmodMap<K,V>
-
- org.organicdesign.fp.collections.PersistentHashMap.MutHashMap<K,V>
-
- All Implemented Interfaces:
Iterable<UnmodMap.UnEntry<K,V>>
,Map<K,V>
,BaseMap<K,V>
,BaseUnsortedMap<K,V>
,MutMap<K,V>
,Sized
,UnmodIterable<UnmodMap.UnEntry<K,V>>
,UnmodMap<K,V>
,Transformable<UnmodMap.UnEntry<K,V>>
- Enclosing class:
- PersistentHashMap<K,V>
public static final class PersistentHashMap.MutHashMap<K,V> extends AbstractUnmodMap<K,V> implements MutMap<K,V>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K extends Object,V extends Object>
-
Nested classes/interfaces inherited from interface org.organicdesign.fp.collections.UnmodIterable
UnmodIterable.UnIterable
-
Nested classes/interfaces inherited from interface org.organicdesign.fp.collections.UnmodMap
UnmodMap.UnEntry<K,V>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull PersistentHashMap.MutHashMap<K,V>
assoc(K key, V val)
Returns a new map with the given key/value added@NotNull Option<UnmodMap.UnEntry<K,V>>
entry(K key)
Returns an option of the key/value pair associated with this keyEquator<K>
equator()
Returns the Equator used by this map for equals comparisons and hashCodes@NotNull PersistentHashMap<K,V>
immutable()
Returns an immutable version of this mutable map.@NotNull 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.@NotNull UnmodIterator<K>
keyIterator()
int
size()
Returns the number of items in this collection or iterable.@NotNull UnmodIterator<V>
valIterator()
@NotNull PersistentHashMap.MutHashMap<K,V>
without(K key)
Returns a new map with the given key/value removed-
Methods inherited from class org.organicdesign.fp.collections.AbstractUnmodMap
equals
-
Methods inherited from class org.organicdesign.fp.collections.AbstractUnmodIterable
hashCode, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.organicdesign.fp.collections.BaseMap
containsKey, get, getOrElse
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Map
equals, forEach, getOrDefault, hashCode
-
Methods inherited from interface org.organicdesign.fp.xform.Transformable
any, toImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutList, toMutMap, toMutRrbt, toMutSet, toMutSortedMap, toMutSortedSet
-
Methods inherited from interface org.organicdesign.fp.collections.UnmodIterable
concat, drop, dropWhile, filter, flatMap, fold, foldUntil, head, map, precat, take, takeWhile, whereNonNull
-
Methods inherited from interface org.organicdesign.fp.collections.UnmodMap
clear, compute, computeIfAbsent, computeIfPresent, containsValue, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, values
-
-
-
-
Method Detail
-
equator
public Equator<K> equator()
Description copied from interface:BaseUnsortedMap
Returns the Equator used by this map for equals comparisons and hashCodes- Specified by:
equator
in interfaceBaseUnsortedMap<K,V>
-
assoc
@NotNull public @NotNull PersistentHashMap.MutHashMap<K,V> assoc(K key, V val)
Description copied from interface:MutMap
Returns a new map with the given key/value added
-
entry
@NotNull public @NotNull Option<UnmodMap.UnEntry<K,V>> entry(K key)
Description copied from interface:BaseMap
Returns an option of the key/value pair associated with this key
-
iterator
@NotNull public @NotNull UnmodIterator<UnmodMap.UnEntry<K,V>> iterator()
Description copied from interface:UnmodIterable
A one-time use, mutable, not-thread-safe way to get each value of the underling collection in turn. I experimented with various thread-safe alternatives, but the JVM is optimized around iterators so this is the lowest common denominator of collection iteration, even though iterators are inherently mutable.
-
keyIterator
@NotNull public @NotNull UnmodIterator<K> keyIterator()
- Specified by:
keyIterator
in interfaceUnmodMap<K,V>
-
valIterator
@NotNull public @NotNull UnmodIterator<V> valIterator()
- Specified by:
valIterator
in interfaceUnmodMap<K,V>
-
without
@NotNull public @NotNull PersistentHashMap.MutHashMap<K,V> without(K key)
Description copied from interface:MutMap
Returns a new map with the given key/value removed
-
immutable
@NotNull public @NotNull PersistentHashMap<K,V> immutable()
Description copied from interface:MutMap
Returns an immutable version of this mutable map.
-
-