Package org.organicdesign.fp.collections
Interface BaseMap<K,V>
-
- All Superinterfaces:
Iterable<UnmodMap.UnEntry<K,V>>
,Map<K,V>
,Sized
,Transformable<UnmodMap.UnEntry<K,V>>
,UnmodIterable<UnmodMap.UnEntry<K,V>>
,UnmodMap<K,V>
- All Known Subinterfaces:
BaseUnsortedMap<K,V>
,ImMap<K,V>
,ImSortedMap<K,V>
,MutMap<K,V>
- All Known Implementing Classes:
PersistentHashMap
,PersistentHashMap.MutHashMap
,PersistentTreeMap
public interface BaseMap<K,V> extends UnmodMap<K,V>
Adds copy-on-write, "fluent interface" methods toUnmodMap
. Lowest common ancestor ofBaseUnsortedMap
, andImSortedMap
.
-
-
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 Abstract Methods Default Methods Modifier and Type Method Description default @NotNull BaseMap<K,V>
assoc(Map.Entry<K,V> entry)
Returns a new map with an immutable copy of the given entry added@NotNull BaseMap<K,V>
assoc(K key, V val)
Returns a new map with the given key/value addeddefault boolean
containsKey(Object key)
@NotNull Option<UnmodMap.UnEntry<K,V>>
entry(K key)
Returns an option of the key/value pair associated with this key@NotNull BaseSet<Map.Entry<K,V>>
entrySet()
Returns a view of the mappings contained in this map.default V
get(Object key)
default V
getOrElse(K key, V notFound)
@NotNull BaseSet<K>
keySet()
Returns a view of the keys contained in this map.@NotNull BaseMap<K,V>
without(K key)
Returns a new map with the given key/value removed-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
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, isEmpty, keyIterator, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, valIterator, values
-
-
-
-
Method Detail
-
entry
@NotNull @NotNull Option<UnmodMap.UnEntry<K,V>> entry(K key)
Returns an option of the key/value pair associated with this key
-
assoc
@NotNull @NotNull BaseMap<K,V> assoc(K key, V val)
Returns a new map with the given key/value added
-
assoc
@NotNull default @NotNull BaseMap<K,V> assoc(@NotNull Map.Entry<K,V> entry)
Returns a new map with an immutable copy of the given entry added
-
without
@NotNull @NotNull BaseMap<K,V> without(K key)
Returns a new map with the given key/value removed
-
entrySet
@NotNull @NotNull BaseSet<Map.Entry<K,V>> entrySet()
Returns a view of the mappings contained in this map. The set should actually contain UnmodMap.Entry items, but that return signature is illegal in Java, so you'll just have to remember.
-
containsKey
default boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<K,V>
-
-