Interface MultimapState<K,V>

Type Parameters:
K - the type of keys maintained by this multimap
V - the type of mapped values
All Superinterfaces:
State

public interface MultimapState<K,V> extends State
A ReadableState cell mapping keys to bags of values. Keys are considered equivalent if their structural values are equivalent, see Coder.structuralValue(T) for additional details.

Implementations of this form of state are expected to implement multimap operations efficiently as supported by some associated backing key-value store.

  • Method Details

    • put

      void put(K key, V value)
      Associates the specified value with the specified key in this multimap. Existing values associated with the same key will not be removed.

      Changes will not be reflected in the results returned by previous calls to ReadableState.read() on the results any of the reading methods(get(K), keys(), entries()).

    • get

      ReadableState<Iterable<V>> get(K key)
      A deferred lookup, returns an empty iterable if the item is not found.

      A user is encouraged to call get for all relevant keys and call readLater() on the results.

      When read is called, a particular state implementation is encouraged to perform all pending reads in a single batch.

    • remove

      void remove(K key)
      Removes all values associated with the key from this multimap. This is a no-op if the key is not contained within the multimap.

      Changes will not be reflected in the results returned by previous calls to ReadableState.read() on the results of any of the reading methods(get(K), keys(), entries()).

    • keys

      Returns an Iterable over the keys contained in this multimap.
    • entries

      Returns an Iterable over all key-value pairs contained in this multimap.
    • containsKey

      ReadableState<Boolean> containsKey(K key)
      Returns a ReadableState whose ReadableState.read() method will return true if this multimap contains the specified key at the point when that ReadableState.read() call returns.
    • isEmpty

      Returns a ReadableState whose ReadableState.read() method will return true if this state is empty at the point when that ReadableState.read() call returns.