public class PartitionedTransactionalMap<K,V> extends Object implements TransactionalMap<K,V>
| Modifier and Type | Field and Description |
|---|---|
protected Hasher<K> |
hasher |
protected Map<PartitionId,TransactionalMapParticipant<K,V>> |
partitions |
| Constructor and Description |
|---|
PartitionedTransactionalMap(Map<PartitionId,TransactionalMapParticipant<K,V>> partitions,
Hasher<K> hasher) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(K key)
Returns true if this map contains a mapping for the specified key.
|
V |
get(K key)
Returns the value to which the specified key is mapped, or null if this
map contains no mapping for the key.
|
V |
put(K key,
V value)
Associates the specified value with the specified key in this map (optional operation).
|
V |
putIfAbsent(K key,
V value)
If the specified key is not already associated with a value
associates it with the given value and returns null, else returns the current value.
|
V |
remove(K key)
Removes the mapping for a key from this map if it is present (optional operation).
|
boolean |
remove(K key,
V value)
Removes the entry for the specified key only if it is currently
mapped to the specified value.
|
boolean |
replace(K key,
V oldValue,
V newValue)
Replaces the entry for the specified key only if currently mapped
to the specified value.
|
String |
toString() |
protected final Map<PartitionId,TransactionalMapParticipant<K,V>> partitions
public PartitionedTransactionalMap(Map<PartitionId,TransactionalMapParticipant<K,V>> partitions, Hasher<K> hasher)
public V get(K key)
TransactionalMapget in interface TransactionalMap<K,V>key - the key whose associated value is to be returnedpublic boolean containsKey(K key)
TransactionalMapcontainsKey in interface TransactionalMap<K,V>key - key whose presence in this map to be testedpublic V put(K key, V value)
TransactionalMapput in interface TransactionalMap<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic V remove(K key)
TransactionalMapremove in interface TransactionalMap<K,V>key - key whose value is to be removed from the mappublic V putIfAbsent(K key, V value)
TransactionalMapputIfAbsent in interface TransactionalMap<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic boolean remove(K key, V value)
TransactionalMapremove in interface TransactionalMap<K,V>key - key with which the specified value is associatedvalue - value expected to be associated with the specified keypublic boolean replace(K key, V oldValue, V newValue)
TransactionalMapreplace in interface TransactionalMap<K,V>key - key with which the specified value is associatedoldValue - value expected to be associated with the specified keynewValue - value to be associated with the specified key