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 Detail

      • get

        default java.util.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

        java.util.stream.Stream<java.util.Map.Entry<K,​V>> entryStream()
        Returns:
        a Stream of 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
      • asMap

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