Interface ValueStore
- All Known Implementing Classes:
DefaultValueStore
public interface ValueStore
Custom value store.
- Author:
- Tadaya Tsuyukubo
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValueStore
create()
Create defaultValueStore
.Get the value associated to the key.<T> T
Get the value associated to the key and cast to the type.<T> T
getOrDefault
(Object key, T defaultValue) Get the value associated to the key; otherwise returns specified value.void
Store a value associating the provided key.void
Store 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
- ifkey
isnull
-
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
- ifkey
isnull
IllegalArgumentException
- iftype
isnull
-
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
- ifkey
isnull
-
put
Store a value associating the provided key.- Parameters:
key
- keyvalue
- value- Throws:
IllegalArgumentException
- ifkey
isnull
IllegalArgumentException
- ifvalue
isnull
-
putAll
Store all key value pairs from provided map.- Parameters:
map
- map- Throws:
IllegalArgumentException
- ifmap
isnull
-
remove
Remove the value associated to the provided key.- Parameters:
key
- key- Returns:
- previously associated value or
null
if key did not exist - Throws:
IllegalArgumentException
- ifkey
isnull
-