Interface PersistentMap<K,V,SelfType extends PersistentMap<K,V,SelfType>>
-
- Type Parameters:
K- the type of keys in the mapV- the type of values in this mapSelfType- the self-type of implementing classes
- All Known Implementing Classes:
PMap
public interface PersistentMap<K,V,SelfType extends PersistentMap<K,V,SelfType>>A persistent map data structure.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.Map<K,V>asMap()An immutable view of this as aMap.default booleancontainsKey(K key)java.util.stream.Stream<java.util.Map.Entry<K,V>>entryStream()default <R> java.util.stream.Stream<R>flatten(java.util.function.BiFunction<K,V,java.util.stream.Stream<R>> f)Sends this map's entries through a flattening function.default java.util.Optional<V>get(K key)SelfTypeminus(K key)SelfTypeplus(K key, V value)
-
-
-
Method Detail
-
get
default java.util.Optional<V> get(K key)
- Parameters:
key-- Returns:
- the value indexed by
keyif it exists
-
plus
SelfType plus(K key, V value)
- Parameters:
key-value-- Returns:
- a new
SelfTypewith a new mapping fromkeytovalue
-
minus
SelfType minus(K key)
- Parameters:
key-- Returns:
- a new
SelfTypewithout the mapping indexed bykey
-
containsKey
default boolean containsKey(K key)
- Parameters:
key-- Returns:
- whether this map contains an entry indexed by
key
-
entryStream
java.util.stream.Stream<java.util.Map.Entry<K,V>> entryStream()
- Returns:
- a
Streamof map entries
-
flatten
default <R> java.util.stream.Stream<R> flatten(java.util.function.BiFunction<K,V,java.util.stream.Stream<R>> f)
Sends this map's entries through a flattening function.- Parameters:
f- a function that flattens one entry into a stream- Returns:
- a stream of flattened entries
-
-