Interface ValueStore
- All Known Implementing Classes:
DefaultValueStore
public interface ValueStore
Custom value store.
- Author:
- Tadaya Tsuyukubo
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValueStorecreate()Creates a defaultValueStore.Returns the value associated with the key.<T> TReturns the value associated with the key and casts it to the specified type.<T> TgetOrDefault(Object key, T defaultValue) Returns the value associated with the key, or the specified default value if none exists.voidStores the provided value under the provided key.voidStores all key/value pairs from the provided map.Removes the value associated with the provided key.
-
Method Details
-
create
-
get
Returns the value associated with the key.- Parameters:
key- key- Returns:
- value; can be
null - Throws:
IllegalArgumentException- ifkeyisnull
-
get
Returns the value associated with the key and casts it to the specified type.- Type Parameters:
T- value type- Parameters:
key- keytype- value type to cast- Returns:
- value; can be
null - Throws:
IllegalArgumentException- ifkeyisnullIllegalArgumentException- iftypeisnull
-
getOrDefault
Returns the value associated with the key, or the specified default value if none exists.- Type Parameters:
T- value type- Parameters:
key- keydefaultValue- default value- Returns:
- value
- Throws:
IllegalArgumentException- ifkeyisnull
-
put
Stores the provided value under the provided key.- Parameters:
key- keyvalue- value- Throws:
IllegalArgumentException- ifkeyisnullIllegalArgumentException- ifvalueisnull
-
putAll
Stores all key/value pairs from the provided map.- Parameters:
map- map- Throws:
IllegalArgumentException- ifmapisnull
-
remove
Removes the value associated with the provided key.- Parameters:
key- key- Returns:
- previously associated value or
nullif key did not exist - Throws:
IllegalArgumentException- ifkeyisnull
-