Class Store<K,​V>

  • Type Parameters:
    K - type of the key
    V - type of the value
    All Implemented Interfaces:
    java.io.Serializable, scala.Equals, scala.Product

    public class Store<K,​V>
    extends java.lang.Object
    implements scala.Product, java.io.Serializable
    Store represents the storage of a set of values against a given key

    param: map initial store map

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Store​(scala.collection.immutable.Map<K,​scala.collection.immutable.Set<V>> map)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Store<K,​V> addOrUpdate​(K key, V value)
      Add or update the value in the store against the given key
      static <K,​V>
      Store<K,​V>
      fromMap​(scala.collection.immutable.Map<K,​scala.collection.immutable.Set<V>> map)
      Create Store for Map of type key -> set of values
      scala.collection.immutable.Set<V> get​(K key)
      Get the set of values against the given key.
      scala.collection.immutable.Map<K,​scala.collection.immutable.Set<V>> map()  
      Store<K,​V> remove​(K key, V value)
      Remove the value from the store against the given key
      Store<K,​V> remove​(V value)
      Remove the value from the store.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface scala.Equals

        canEqual, equals
      • Methods inherited from interface scala.Product

        productArity, productElement, productElementName, productElementNames, productIterator, productPrefix
    • Constructor Detail

      • Store

        public Store​(scala.collection.immutable.Map<K,​scala.collection.immutable.Set<V>> map)
    • Method Detail

      • fromMap

        public static <K,​V> Store<K,​V> fromMap​(scala.collection.immutable.Map<K,​scala.collection.immutable.Set<V>> map)
        Create Store for Map of type key -> set of values

        Parameters:
        map - of type key -> set of values
        Returns:
        A Store for managing map of type key -> set of values
      • map

        public scala.collection.immutable.Map<K,​scala.collection.immutable.Set<V>> map()
      • addOrUpdate

        public Store<K,​V> addOrUpdate​(K key,
                                            V value)
        Add or update the value in the store against the given key

        Parameters:
        key - key of the store
        value - value against the key
        Returns:
        updated store after adding/update value
      • remove

        public Store<K,​V> remove​(K key,
                                       V value)
        Remove the value from the store against the given key

        Parameters:
        key - key of the store
        value - value to be removed against the key
        Returns:
        updated store after removing the value
      • remove

        public Store<K,​V> remove​(V value)
        Remove the value from the store. The value could be present against multiple keys and it will be removed from all places.

        Parameters:
        value - value to be removed from the store
        Returns:
        updated store after removing the value
      • get

        public scala.collection.immutable.Set<V> get​(K key)
        Get the set of values against the given key. If the key is not present then empty set would be returned

        Parameters:
        key - get the values against the given key
        Returns:
        set of values or empty set if key is not present