Package org.apache.beam.sdk.state
Interface SetState<T>
- Type Parameters:
T- The type of elements in the set.
- All Superinterfaces:
GroupingState<T,,Iterable<T>> ReadableState<Iterable<T>>,State
A
ReadableState cell containing a set of elements.
Implementations of this form of state are expected to implement set operations such as contains(Object) efficiently, reading as little of the overall set as possible.
-
Method Summary
Modifier and TypeMethodDescriptionaddIfAbsent(T t) Ensures a value is a member of the set, returningtrueif it was added andfalseotherwise.Returns aReadableStatewhoseReadableState.read()method will return true if this set contains the specified element at the point when thatReadableState.read()call returns.Indicate that the value will be read later.voidRemoves the specified element from this set if it is present.Methods inherited from interface org.apache.beam.sdk.state.GroupingState
add, isEmptyMethods inherited from interface org.apache.beam.sdk.state.ReadableState
read
-
Method Details
-
contains
Returns aReadableStatewhoseReadableState.read()method will return true if this set contains the specified element at the point when thatReadableState.read()call returns. -
addIfAbsent
Ensures a value is a member of the set, returningtrueif it was added andfalseotherwise.Elements added will not be reflected in
OutputTobjects returned by previous calls toReadableState.read(). -
remove
Removes the specified element from this set if it is present.Changes will not be reflected in
OutputTobjects returned by previous calls toReadableState.read(). -
readLater
Description copied from interface:ReadableStateIndicate that the value will be read later.This allows an implementation to start an asynchronous prefetch or to include this state in the next batch of reads.
- Specified by:
readLaterin interfaceGroupingState<T,Iterable<T>> - Specified by:
readLaterin interfaceReadableState<T>- Returns:
- this for convenient chaining
-