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, returningtrue
if it was added andfalse
otherwise.Returns aReadableState
whoseReadableState.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.void
Removes the specified element from this set if it is present.Methods inherited from interface org.apache.beam.sdk.state.GroupingState
add, isEmpty
Methods inherited from interface org.apache.beam.sdk.state.ReadableState
read
-
Method Details
-
contains
Returns aReadableState
whoseReadableState.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, returningtrue
if it was added andfalse
otherwise.Elements added will not be reflected in
OutputT
objects returned by previous calls toReadableState.read()
. -
remove
Removes the specified element from this set if it is present.Changes will not be reflected in
OutputT
objects returned by previous calls toReadableState.read()
. -
readLater
Description copied from interface:ReadableState
Indicate 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:
readLater
in interfaceGroupingState<T,
Iterable<T>> - Specified by:
readLater
in interfaceReadableState<T>
- Returns:
- this for convenient chaining
-