KeyT
- Table Key Type.ValueT
- Table Value Type.public interface KeyValueTableMap<KeyT,ValueT>
extends java.util.Map<KeyT,ValueT>
Map
implementation for a KeyValueTable
's Key Family.
All methods inherited from Map
respect the contracts defined in that interface, except as noted below.
Performance considerations:
Map
interface defines synchronous operations, however KeyValueTable
defines async operations.
All method implementations defined in this interface or inherited from Map
invoke
CompletableFuture.join()
on any KeyValueTable
methods invoked. This means that two threads are used
to fulfill these calls: one from the Executor passed in to the KeyValueTable
factory, and one on which this
request is executing.
KeyValueTable
:
Map.containsKey(java.lang.Object)
.
Map.get(java.lang.Object)
, Map.getOrDefault(java.lang.Object, V)
.
putDirect(KeyT, ValueT)
, Map.putAll(java.util.Map<? extends K, ? extends V>)
, Map.putIfAbsent(K, V)
.
removeDirect(KeyT)
.
Map.isEmpty()
(Invokes KeyValueTable.keyIterator(java.lang.String, int, io.pravega.client.tables.IteratorState)
and requests a single item).
Map.keySet()
: Set.removeAll(java.util.Collection<?>)
, Set.contains(java.lang.Object)
, Set.containsAll(java.util.Collection<?>)
, Set.isEmpty()
.
Map.entrySet()
: Set.contains(java.lang.Object)
, Set.containsAll(java.util.Collection<?>)
, Set.isEmpty()
, Set.add(E)
, Set.addAll(java.util.Collection<? extends E>)
.
KeyValueTable
:
Map.put(K, V)
(refer to {putDirect(KeyT, ValueT)
if the old value is not needed).
Map.replace(K, V, V)
.
Map.remove(java.lang.Object)
(refer to removeDirect(KeyT)
if the old value is not needed).
Map.computeIfPresent(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>)
, Map.compute(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>)
}, Map.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>)
.
Map.keySet()
Set.remove(java.lang.Object)
.
Map.entrySet()
: Set.removeAll(java.util.Collection<?>)
, Set.isEmpty()
.
KeyValueTable.keyIterator(java.lang.String, int, io.pravega.client.tables.IteratorState)
:
Map.keySet()
Set.iterator()
(Iterates as Iterator.hasNext()
or Iterator.next()
are
invoked. Calls to Iterator.remove()
will result in a single call to KeyValueTable
).
Map.size()
(Iterates through the entire iterator).
Map.clear()
(Iterates through the entire iterator and makes repeated calls to KeyValueTable.removeAll(java.lang.String, java.lang.Iterable<io.pravega.client.tables.TableKey<KeyT>>)
).
Map.keySet()
: Set.clear()
, Collection.removeIf(java.util.function.Predicate<? super E>)
, Set.retainAll(java.util.Collection<?>)
.
KeyValueTable.entryIterator(java.lang.String, int, io.pravega.client.tables.IteratorState)
:
Map.containsValue(java.lang.Object)
.
Map.replaceAll(java.util.function.BiFunction<? super K, ? super V, ? extends V>)
(which makes multiple calls to KeyValueTable.putAll(java.lang.String, java.lang.Iterable<java.util.Map.Entry<KeyT, ValueT>>)
as well).
Map.entrySet()
Set.iterator()
(Iterates as Iterator.hasNext()
or Iterator.next()
are
invoked. Calls to Iterator.remove()
will result in a single call to KeyValueTable
).
Map.entrySet()
: Collection.removeIf(java.util.function.Predicate<? super E>)
, Set.retainAll(java.util.Collection<?>)
Map.values()
.
Collection.stream()
}, Collection.spliterator()
or Collection.toArray()
on
Map.keySet()
, Map.entrySet()
or Map.values()
will invoke those collections' iterators (see above).
If getKeyFamily()
is null), the following operations are not supported and will throw throw
UnsupportedOperationException
).
Map.containsValue(java.lang.Object)
.
Map.putAll(java.util.Map<? extends K, ? extends V>)
.
Map.replaceAll(java.util.function.BiFunction<? super K, ? super V, ? extends V>)
.
Map.keySet()
.
Map.values()
.
Map.entrySet()
.
Map.size()
.
Map.isEmpty()
.
Map.clear()
.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getKeyFamily()
Gets the Key Family over which this
KeyValueTableMap applies. |
void |
putDirect(KeyT key,
ValueT value)
Same as
Map.put(K, V) , but does not attempt to retrieve the existing value. |
void |
removeDirect(KeyT key)
Same as
Map.remove(java.lang.Object) , but does not attempt to retrieve the existing value. |
java.lang.String getKeyFamily()
KeyValueTableMap
applies.void putDirect(@NonNull KeyT key, @NonNull ValueT value)
Map.put(K, V)
, but does not attempt to retrieve the existing value. Results in a single call to the wrapped
KeyValueTable
.key
- The Key to insert or update.value
- The value to associate with the key.void removeDirect(@NonNull KeyT key)
Map.remove(java.lang.Object)
, but does not attempt to retrieve the existing value. Results in a single call to the
wrapped KeyValueTable
.key
- The key to remove.