Interface ValueStore
- All Known Implementing Classes:
DefaultValueStore
public interface ValueStore
Custom value store.
- Author:
- Tadaya Tsuyukubo
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValueStorecreate()Create defaultValueStore.Get the value associated to the key.<T> TGet the value associated to the key and cast to the type.<T> TgetOrDefault(Object key, T defaultValue) Get the value associated to the key; otherwise returns specified value.voidStore a value associating the provided key.voidStore all key value pairs from provided map.Remove the value associated to the provided key.
-
Method Details
-
create
-
get
Get the value associated to the key.- Parameters:
key- key- Returns:
- value; can be
null - Throws:
IllegalArgumentException- ifkeyisnull
-
get
Get the value associated to the key and cast to the type.- Type Parameters:
T- value type- Parameters:
key- keytype- value type to cast- Returns:
- value; can be
null - Throws:
IllegalArgumentException- ifkeyisnullIllegalArgumentException- iftypeisnull
-
getOrDefault
Get the value associated to the key; otherwise returns specified value.- Type Parameters:
T- value type- Parameters:
key- keydefaultValue- default value- Returns:
- value
- Throws:
IllegalArgumentException- ifkeyisnull
-
put
Store a value associating the provided key.- Parameters:
key- keyvalue- value- Throws:
IllegalArgumentException- ifkeyisnullIllegalArgumentException- ifvalueisnull
-
putAll
Store all key value pairs from provided map.- Parameters:
map- map- Throws:
IllegalArgumentException- ifmapisnull
-
remove
Remove the value associated to the provided key.- Parameters:
key- key- Returns:
- previously associated value or
nullif key did not exist - Throws:
IllegalArgumentException- ifkeyisnull
-