Package csw.command.client
Class Store<K,V>
- java.lang.Object
-
- csw.command.client.Store<K,V>
-
- Type Parameters:
K
- type of the keyV
- 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 keyparam: map initial store map
- See Also:
- Serialized Form
-
-
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 keystatic <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 valuesscala.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 keyStore<K,V>
remove(V value)
Remove the value from the store.
-
-
-
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
-
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 storevalue
- 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 storevalue
- 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
-
-