Interface ImmutableMap<K,​V>

  • All Superinterfaces:
    java.lang.Iterable<TrieKVP<K,​V>>
    All Known Implementing Classes:
    ImmutableHashTrieMap

    public interface ImmutableMap<K,​V>
    extends java.lang.Iterable<TrieKVP<K,​V>>
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      V get​(K key)
      Retrieve a stored value from the map based on the key for the associated entry.
      java.util.Iterator<TrieKVP<K,​V>> iterator()
      Iterate over the entries in the map
      ImmutableMap<K,​V> put​(K key, V value)
      Add a new entry to the map.
      ImmutableMap<K,​V> remove​(K key)
      Remove an entry from the map.
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • put

        ImmutableMap<K,​V> put​(K key,
                                    V value)
        Add a new entry to the map. If an entry already exists with the given key, the returned map will contain this entry, but not the existing entry.
        Parameters:
        key - the key to use to retrieve this item
        value - the value stored for this item
        Returns:
        a new map with this item added
      • remove

        ImmutableMap<K,​V> remove​(K key)
        Remove an entry from the map. If no entry exists with the given key, the returned map will have identical contents to the original map (and may, in fact, be the original map itself).
        Parameters:
        key - the key for the entry to remove
        Returns:
        a new map with the entry with the given key removed (or a map with the original contents if no entry was found for the given key).
      • get

        V get​(K key)
        Retrieve a stored value from the map based on the key for the associated entry. If no entry exists with the given key, we return None.
        Parameters:
        key - the key for the entry to retrieve
        Returns:
        Some(value) if an entry exists with the given key, or None if no entry with the given key was found.
      • iterator

        java.util.Iterator<TrieKVP<K,​V>> iterator()
        Iterate over the entries in the map
        Specified by:
        iterator in interface java.lang.Iterable<K>
        Returns:
        an iterator over the key-value pairs held in the map