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 aReadableStatewhoseReadableState.read()method will return true if this multimap contains the specified key at the point when thatReadableState.read()call returns.entries()Returns anIterableover all key-value pairs contained in this multimap.A deferred lookup, returns an empty iterable if the item is not found.isEmpty()Returns aReadableStatewhoseReadableState.read()method will return true if this state is empty at the point when thatReadableState.read()call returns.keys()Returns anIterableover the keys contained in this multimap.voidAssociates the specified value with the specified key in this multimap.voidRemoves 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
getfor all relevant keys and callreadLater()on the results.When
readis 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 anIterableover the keys contained in this multimap. -
entries
ReadableState<Iterable<Map.Entry<K,V>>> entries()Returns anIterableover all key-value pairs contained in this multimap. -
containsKey
Returns aReadableStatewhoseReadableState.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 aReadableStatewhoseReadableState.read()method will return true if this state is empty at the point when thatReadableState.read()call returns.
-