Interface PMap<K,​V>

  • Type Parameters:
    K - the type of keys maintained by this map
    V - the type of mapped values

    public interface PMap<K,​V>
    Persistent (functional) Map.
    Author:
    Evgeny Mandrikov
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void forEach​(BiConsumer<K,​V> action)
      Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
      V get​(K key)  
      boolean isEmpty()  
      PMap<K,​V> put​(K key, V value)  
      PMap<K,​V> remove​(K key)  
      String toString()
      The string representation consists of a list of key-value mappings in the ascending order of hash codes of keys.
    • Method Detail

      • put

        PMap<K,​V> put​(K key,
                            V value)
        Returns:
        new map with added key-value pair, or this if map already contains given key-value pair
      • remove

        PMap<K,​V> remove​(K key)
        Returns:
        new map with removed key, or this if map does not contain given key
      • get

        @Nullable
        V get​(K key)
        Returns:
        value associated with given key, or null if not found
      • forEach

        void forEach​(BiConsumer<K,​V> action)
        Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
      • isEmpty

        boolean isEmpty()
        Returns:
        true if this map contains no elements
      • toString

        String toString()
        The string representation consists of a list of key-value mappings in the ascending order of hash codes of keys. If two keys have same hash code, then their relative order is arbitrary, but stable.
        Overrides:
        toString in class Object
        Returns:
        a string representation of this map