Package kalix.javasdk.replicatedentity
Interface ReplicatedRegisterMap<K,V>
- Type Parameters:
K
- The type for keys.V
- The type for values.
- All Superinterfaces:
kalix.replicatedentity.ReplicatedData
public interface ReplicatedRegisterMap<K,V>
extends kalix.replicatedentity.ReplicatedData
A Map of registers. Uses
ReplicatedRegister
's as values.-
Method Summary
Modifier and TypeMethodDescriptionclear()
Remove all mappings from this register map.boolean
containsKey
(K key) Check whether this register map contains a mapping for the given key.Get the current value of the register at the given key.boolean
isEmpty()
Check whether this register map is empty.keySet()
Get aSet
view of the keys contained in this register map.Remove the mapping for a key if it is present.default ReplicatedRegisterMap<K,
V> Set the current value of the register at the given key, using the default clock.setValue
(K key, V value, ReplicatedRegister.Clock clock, long customClockValue) Set the current value of the register at the given key, using the given clock and custom clock value if required.int
size()
Get the number of key-register mappings in this register map.
-
Method Details
-
getValue
Get the current value of the register at the given key.- Parameters:
key
- the key for the register- Returns:
- the current value of the register, if it exists (as an Optional)
-
setValue
Set the current value of the register at the given key, using the default clock.- Parameters:
key
- the key for the registervalue
- the new value of the register- Returns:
- a new register map with the updated value
-
setValue
ReplicatedRegisterMap<K,V> setValue(K key, V value, ReplicatedRegister.Clock clock, long customClockValue) Set the current value of the register at the given key, using the given clock and custom clock value if required.- Parameters:
key
- the key for the registervalue
- the new value of the registerclock
- the clock to use for replicationcustomClockValue
- the custom clock value to use, only if it's a custom clock- Returns:
- a new register map with the updated value
-
remove
Remove the mapping for a key if it is present.- Parameters:
key
- key whose mapping is to be removed from the map- Returns:
- a new register map with the removed mapping
-
clear
ReplicatedRegisterMap<K,V> clear()Remove all mappings from this register map.- Returns:
- a new empty register map
-
size
int size()Get the number of key-register mappings in this register map.- Returns:
- the number of key-register mappings in this register map
-
isEmpty
boolean isEmpty()Check whether this register map is empty.- Returns:
true
if this register map contains no key-register mappings
-
containsKey
Check whether this register map contains a mapping for the given key.- Parameters:
key
- key whose presence in this map is to be tested- Returns:
true
if this register map contains a mapping for the given key
-
keySet
Get aSet
view of the keys contained in this register map.- Returns:
- the keys contained in this register map
-