Class AbstractValueStorage<K,V>
java.lang.Object
ru.progrm_jarvis.javacommons.object.valuestorage.AbstractValueStorage<K,V>
- Type Parameters:
K- type of keys used for identifying valuesV- type of stored values
- All Implemented Interfaces:
ValueStorage<K,V>
- Direct Known Subclasses:
SimpleValueStorage
Abstract base for
ValueStorage.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanprotected abstract KGenerates a new key for storing the unique value.inthashCode()retrieveValue(K key) Retrieves (gets and removes) the value stored by the given key.storeValue(V value) Stores the given non-null value returning its unique key.toString()
-
Field Details
-
values
Values stored by their unique keys
-
-
Constructor Details
-
AbstractValueStorage
-
-
Method Details
-
generateNewKey
Generates a new key for storing the unique value.- Returns:
- newly generated unique key
-
storeValue
Description copied from interface:ValueStorageStores the given non-null value returning its unique key.- Specified by:
storeValuein interfaceValueStorage<K,V> - Parameters:
value- non-null value to store- Returns:
- unique key by which the stored value may be retrieved
-
retrieveValue
Description copied from interface:ValueStorageRetrieves (gets and removes) the value stored by the given key.- Specified by:
retrieveValuein interfaceValueStorage<K,V> - Parameters:
key- unique key by which the value should be found- Returns:
- value which was stored by the given key or
nullif there was no value stored
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-