Package org.apache.beam.sdk.state
Interface MultimapState<K,V>
- Type Parameters:
K
- the type of keys maintained by this multimapV
- the type of mapped values
- All Superinterfaces:
State
A
ReadableState
cell mapping keys to bags of values. Keys are considered equivalent if
their structural values are equivalent, see Coder.structuralValue(T)
for additional details.
Implementations of this form of state are expected to implement multimap operations efficiently as supported by some associated backing key-value store.
-
Method Summary
Modifier and TypeMethodDescriptioncontainsKey
(K key) Returns aReadableState
whoseReadableState.read()
method will return true if this multimap contains the specified key at the point when thatReadableState.read()
call returns.entries()
Returns anIterable
over all key-value pairs contained in this multimap.A deferred lookup, returns an empty iterable if the item is not found.isEmpty()
Returns aReadableState
whoseReadableState.read()
method will return true if this state is empty at the point when thatReadableState.read()
call returns.keys()
Returns anIterable
over the keys contained in this multimap.void
Associates the specified value with the specified key in this multimap.void
Removes all values associated with the key from this multimap.
-
Method Details
-
put
Associates the specified value with the specified key in this multimap. Existing values associated with the same key will not be removed.Changes will not be reflected in the results returned by previous calls to
ReadableState.read()
on the results any of the reading methods(get(K)
,keys()
,entries()
). -
get
A deferred lookup, returns an empty iterable if the item is not found.A user is encouraged to call
get
for all relevant keys and callreadLater()
on the results.When
read
is called, a particular state implementation is encouraged to perform all pending reads in a single batch. -
remove
Removes all values associated with the key from this multimap. This is a no-op if the key is not contained within the multimap.Changes will not be reflected in the results returned by previous calls to
ReadableState.read()
on the results of any of the reading methods(get(K)
,keys()
,entries()
). -
keys
ReadableState<Iterable<K>> keys()Returns anIterable
over the keys contained in this multimap. -
entries
ReadableState<Iterable<Map.Entry<K,V>>> entries()Returns anIterable
over all key-value pairs contained in this multimap. -
containsKey
Returns aReadableState
whoseReadableState.read()
method will return true if this multimap contains the specified key at the point when thatReadableState.read()
call returns. -
isEmpty
ReadableState<Boolean> isEmpty()Returns aReadableState
whoseReadableState.read()
method will return true if this state is empty at the point when thatReadableState.read()
call returns.
-