Package org.organicdesign.fp.collections
Class PersistentHashMap.MutableHashMap<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.MutableHashMap<K,V>
-
- All Implemented Interfaces:
java.lang.Iterable<UnmodMap.UnEntry<K,V>>,java.util.Map<K,V>,BaseMap<K,V>,BaseUnsortedMap<K,V>,MutableMap<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.MutableHashMap<K,V> extends AbstractUnmodMap<K,V> implements MutableMap<K,V>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K extends java.lang.Object,V extends java.lang.Object>
-
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 PersistentHashMap.MutableHashMap<K,V>assoc(K key, V val)Returns a new map with the given key/value addedOption<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 hashCodesPersistentHashMap<K,V>immutable()Returns an immutable version of this 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.UnmodIterator<K>keyIterator()intsize()Returns the number of items in this collection or iterable.UnmodIterator<V>valIterator()PersistentHashMap.MutableHashMap<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 org.organicdesign.fp.collections.MutableMap
assoc, entrySet, keySet
-
Methods inherited from interface org.organicdesign.fp.xform.Transformable
toImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutableList, toMutableMap, toMutableRrbt, toMutableSet, toMutableSortedMap, toMutableSortedSet
-
Methods inherited from interface org.organicdesign.fp.collections.UnmodIterable
concat, drop, dropWhile, filter, flatMap, fold, foldUntil, head, map, precat, take, takeWhile
-
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:BaseUnsortedMapReturns the Equator used by this map for equals comparisons and hashCodes- Specified by:
equatorin interfaceBaseUnsortedMap<K,V>
-
assoc
public PersistentHashMap.MutableHashMap<K,V> assoc(K key, V val)
Description copied from interface:MutableMapReturns a new map with the given key/value added
-
entry
public Option<UnmodMap.UnEntry<K,V>> entry(K key)
Description copied from interface:BaseMapReturns an option of the key/value pair associated with this key
-
iterator
public UnmodIterator<UnmodMap.UnEntry<K,V>> iterator()
Description copied from interface:UnmodIterableA 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.- Specified by:
iteratorin interfacejava.lang.Iterable<K>- Specified by:
iteratorin interfaceUnmodIterable<K>
-
keyIterator
public UnmodIterator<K> keyIterator()
- Specified by:
keyIteratorin interfaceUnmodMap<K,V>
-
valIterator
public UnmodIterator<V> valIterator()
- Specified by:
valIteratorin interfaceUnmodMap<K,V>
-
without
public final PersistentHashMap.MutableHashMap<K,V> without(K key)
Description copied from interface:MutableMapReturns a new map with the given key/value removed
-
immutable
public final PersistentHashMap<K,V> immutable()
Description copied from interface:MutableMapReturns an immutable version of this mutable map.- Specified by:
immutablein interfaceMutableMap<K,V>
-
-