Package org.organicdesign.fp.collections
Class AbstractUnmodMap<K,V>
- java.lang.Object
-
- org.organicdesign.fp.collections.AbstractUnmodIterable<UnmodMap.UnEntry<K,V>>
-
- org.organicdesign.fp.collections.AbstractUnmodMap<K,V>
-
- All Implemented Interfaces:
Iterable<UnmodMap.UnEntry<K,V>>
,Map<K,V>
,Sized
,UnmodIterable<UnmodMap.UnEntry<K,V>>
,UnmodMap<K,V>
,Transformable<UnmodMap.UnEntry<K,V>>
- Direct Known Subclasses:
PersistentHashMap
,PersistentHashMap.MutHashMap
,PersistentTreeMap
public abstract class AbstractUnmodMap<K,V> extends AbstractUnmodIterable<UnmodMap.UnEntry<K,V>> implements UnmodMap<K,V>
Implements equals() and hashCode() methods compatible with java.util.Map (which ignores order) to make defining unmod Maps easier. Inherits hashCode() and toString() from AbstractUnmodIterable.
-
-
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>
-
-
Constructor Summary
Constructors Constructor Description AbstractUnmodMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
When comparing against a SortedMap, this is correct and O(n) fast, but BEWARE! It is also Compatible withAbstractMap.equals(Object)
which unfortunately means equality as defined by this method (and java.util.AbstractMap) is not commutative when comparing ordered and unordered maps (it is also O(n log n) slow).-
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 java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Map
containsKey, forEach, get, getOrDefault, hashCode, size
-
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, iterator, map, precat, take, takeWhile, whereNonNull
-
Methods inherited from interface org.organicdesign.fp.collections.UnmodMap
clear, compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, isEmpty, keyIterator, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, valIterator, values
-
-
-
-
Method Detail
-
equals
public boolean equals(Object other)
When comparing against a SortedMap, this is correct and O(n) fast, but BEWARE! It is also Compatible withAbstractMap.equals(Object)
which unfortunately means equality as defined by this method (and java.util.AbstractMap) is not commutative when comparing ordered and unordered maps (it is also O(n log n) slow). The Equator defined by this class prevents comparison with unordered Maps.
-
-