Package oracle.pgx.algorithm
Interface PgxMap<K,V>
-
- Type Parameters:
K
-V
-
public interface PgxMap<K,V>
A map from keys to values.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Remove all key-value pairs from the map.boolean
containsKey(K key)
Check if the map contains the given key.static <K,V>
PgxMap<K,V>create()
Instantiate a new map.void
decrement(K key)
Decrement the value at the given key.V
get(K key)
Get the value for the given key.K
getKeyForMaxValue()
Get the key for the largest value in the map.K
getKeyForMinValue()
Get the key for the smallest value in the map.V
getMaxValue()
Returns the largest value in the map.V
getMinValue()
Returns the smallest value in the map.boolean
hasMaxValue(K key)
Check if the given key is mapped to the largest value in the map.boolean
hasMinValue(K key)
Check if the given key is mapped to the smallest value in the map.void
increment(K key)
Increment the value at the given key.PgxCollection<K>
keys()
Get the keys in this map.void
reduceAdd(K key, V value)
Atomically update the value for the given key to the sum of the current value and the given value.void
reduceAnd(K key, V value)
Atomically update the value for the given key to the conjunction of the current value and the given value.void
reduceMax(K key, V value)
Atomically update the value for the given key to the maximum of the current value and the given value..void
reduceMin(K key, V value)
Atomically update the value for the given key to the minimum of the current value and the given value..void
reduceMul(K key, V value)
Atomically update the value for the given key to the multiplication of the current value and the given value.void
reduceOr(K key, V value)
Atomically update the value for the given key to the disjunction of the current value and the given value.void
remove(K key)
Remove the value for the given key from the map.void
set(K key, V value)
Put a value for the given key in the map.long
size()
Get the number of elements in the map.PgxCollection<V>
values()
Get the values in this map.
-
-
-
Method Detail
-
create
static <K,V> PgxMap<K,V> create()
Instantiate a new map.- Returns:
-
remove
void remove(K key)
Remove the value for the given key from the map.- Parameters:
key
-
-
size
long size()
Get the number of elements in the map.- Returns:
-
containsKey
boolean containsKey(K key)
Check if the map contains the given key.- Returns:
-
keys
PgxCollection<K> keys()
Get the keys in this map.- Returns:
-
values
PgxCollection<V> values()
Get the values in this map.- Returns:
-
getKeyForMaxValue
K getKeyForMaxValue()
Get the key for the largest value in the map.- Returns:
-
getKeyForMinValue
K getKeyForMinValue()
Get the key for the smallest value in the map.- Returns:
-
hasMaxValue
boolean hasMaxValue(K key)
Check if the given key is mapped to the largest value in the map.- Parameters:
key
-- Returns:
-
hasMinValue
boolean hasMinValue(K key)
Check if the given key is mapped to the smallest value in the map.- Parameters:
key
-- Returns:
-
getMaxValue
V getMaxValue()
Returns the largest value in the map.- Returns:
-
getMinValue
V getMinValue()
Returns the smallest value in the map.- Returns:
-
increment
void increment(K key)
Increment the value at the given key.- Parameters:
key
-
-
decrement
void decrement(K key)
Decrement the value at the given key.- Parameters:
key
-
-
clear
void clear()
Remove all key-value pairs from the map.
-
reduceAdd
void reduceAdd(K key, V value)
Atomically update the value for the given key to the sum of the current value and the given value.- Parameters:
key
-value
-
-
reduceMul
void reduceMul(K key, V value)
Atomically update the value for the given key to the multiplication of the current value and the given value.- Parameters:
key
-value
-
-
reduceOr
void reduceOr(K key, V value)
Atomically update the value for the given key to the disjunction of the current value and the given value.- Parameters:
key
-value
-
-
reduceAnd
void reduceAnd(K key, V value)
Atomically update the value for the given key to the conjunction of the current value and the given value.- Parameters:
key
-value
-
-
reduceMax
void reduceMax(K key, V value)
Atomically update the value for the given key to the maximum of the current value and the given value..- Parameters:
key
-value
-
-
-