Interface PersistentMap<K,V,SelfType extends PersistentMap<K,V,SelfType>>

Type Parameters:
K - the type of keys in the map
V - the type of values in this map
SelfType - 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 Details

    • get

      default Optional<V> get(K key)
      Parameters:
      key -
      Returns:
      the value indexed by key if it exists
    • plus

      SelfType plus(K key, V value)
      Parameters:
      key -
      value -
      Returns:
      a new SelfType with a new mapping from key to value
    • minus

      SelfType minus(K key)
      Parameters:
      key -
      Returns:
      a new SelfType without the mapping indexed by key
    • containsKey

      default boolean containsKey(K key)
      Parameters:
      key -
      Returns:
      whether this map contains an entry indexed by key
    • entryStream

      Stream<Map.Entry<K,V>> entryStream()
      Returns:
      a Stream of map entries
    • flatten

      default <R> Stream<R> flatten(BiFunction<K,V,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
    • asMap

      Map<K,V> asMap()
      An immutable view of this as a Map.