Interface SetState<T>

Type Parameters:
T - The type of elements in the set.
All Superinterfaces:
GroupingState<T,Iterable<T>>, ReadableState<Iterable<T>>, State

public interface SetState<T> extends GroupingState<T,Iterable<T>>
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 Details

    • contains

      ReadableState<Boolean> contains(T t)
      Returns a ReadableState whose ReadableState.read() method will return true if this set contains the specified element at the point when that ReadableState.read() call returns.
    • addIfAbsent

      ReadableState<Boolean> addIfAbsent(T t)
      Ensures a value is a member of the set, returning true if it was added and false otherwise.

      Elements added will not be reflected in OutputT objects returned by previous calls to ReadableState.read().

    • remove

      void remove(T t)
      Removes the specified element from this set if it is present.

      Changes will not be reflected in OutputT objects returned by previous calls to ReadableState.read().

    • readLater

      SetState<T> 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 interface GroupingState<T,Iterable<T>>
      Specified by:
      readLater in interface ReadableState<T>
      Returns:
      this for convenient chaining