Package org.incendo.cloud.key
Interface MutableCloudKeyContainer
- All Superinterfaces:
CloudKeyContainer
- All Known Subinterfaces:
AggregateParsingContext<C>
- All Known Implementing Classes:
CommandContext,SimpleMutableCloudKeyContainer
-
Method Summary
Modifier and TypeMethodDescription<V> VcomputeIfAbsent(@NonNull CloudKey<V> key, @NonNull Function<@NonNull CloudKey<V>, V> defaultFunction) Returns the value associated with the givenkeyif it exists, else computes and stores the value returned by the givendefaultFunctionand then returns it.default <V> VcomputeIfAbsent(@NonNull CloudKeyHolder<V> keyHolder, @NonNull Function<@NonNull CloudKey<V>, V> defaultFunction) Returns the value associated with the givenkeyHolderif it exists, else computes and stores the value returned by the givendefaultFunctionand then returns it.default voidRemoves value associated with the givenkey.voidRemoves value associated with the givenkey.default voidremove(@NonNull CloudKeyHolder<?> keyHolder) Removes value associated with the givenkeyHolder.default <V> voidSets thevalueassociated with the givenkey.default <V> voidSets thevalueassociated with the givenkey.default <V> voidset(@NonNull CloudKeyHolder<V> keyHolder, @Nullable V value) Sets thevalueassociated with the givenkeyHolder.Stores thekey-valuepair.Stores thekey-valuepair.store(@NonNull CloudKeyHolder<V> keyHolder, V value) Stores the key-value pair for the key held by thekeyHolder.Methods inherited from interface org.incendo.cloud.key.CloudKeyContainer
all, contains, contains, contains, get, get, get, getOrDefault, getOrDefault, getOrDefault, getOrSupplyDefault, getOrSupplyDefault, getOrSupplyDefault, optional, optional, optional
-
Method Details
-
store
Stores thekey-valuepair.This will overwrite any existing value stored with the same
key.- Type Parameters:
V- the type of the value- Parameters:
key- the keyvalue- the value
-
store
Stores thekey-valuepair.This will overwrite any existing value stored with the same
key.- Type Parameters:
V- the type of the value- Parameters:
key- the keyvalue- the value
-
store
Stores the key-value pair for the key held by thekeyHolder.This will overwrite any existing value stored with the same key.
- Type Parameters:
V- the type of the value- Parameters:
keyHolder- the holder of the keyvalue- the value
-
remove
Removes value associated with the givenkey.- Parameters:
key- the key
-
remove
Removes value associated with the givenkey.- Parameters:
key- the key
-
remove
Removes value associated with the givenkeyHolder.- Parameters:
keyHolder- the holder of the key
-
set
- Type Parameters:
V- the type of the value- Parameters:
key- the keyvalue- the value
-
set
- Type Parameters:
V- the type of the value- Parameters:
key- the keyvalue- the value
-
set
- Type Parameters:
V- the type of the value- Parameters:
keyHolder- the holder of the keyvalue- the value
-
computeIfAbsent
<V> V computeIfAbsent(@NonNull CloudKey<V> key, @NonNull Function<@NonNull CloudKey<V>, V> defaultFunction) Returns the value associated with the givenkeyif it exists, else computes and stores the value returned by the givendefaultFunctionand then returns it.- Type Parameters:
V- the type of the value- Parameters:
key- the keydefaultFunction- the function used to generate the value in case it's missing- Returns:
- the present or computed value
-
computeIfAbsent
default <V> V computeIfAbsent(@NonNull CloudKeyHolder<V> keyHolder, @NonNull Function<@NonNull CloudKey<V>, V> defaultFunction) Returns the value associated with the givenkeyHolderif it exists, else computes and stores the value returned by the givendefaultFunctionand then returns it.- Type Parameters:
V- the type of the value- Parameters:
keyHolder- the holder of the keydefaultFunction- the function used to generate the value in case it's missing- Returns:
- the present or computed value
-