Interface ListState<S>

All Superinterfaces:
Serializable

public interface ListState<S> extends Serializable
Interface used for arbitrary stateful operations with the v2 API to capture list value state.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendList(Object newState)
    Function to append a list of entries to the existing state list.
    void
    appendValue(S newState)
    Function to append a single entry to the existing state list.
    void
    Function to remove the state for the current grouping key.
    boolean
    Function to check whether state exists for current grouping key or not.
    scala.collection.Iterator<S>
    get()
    Function to get the list of elements in the state as an iterator.
    void
    put(Object newState)
    Function to update the value of the state with a new list.
  • Method Details

    • appendList

      void appendList(Object newState)
      Function to append a list of entries to the existing state list.

      Note that if this is the first time the state is being appended to, the state will be initialized to an empty list before appending the new entries.

      Parameters:
      newState - - list of elements to be appended
    • appendValue

      void appendValue(S newState)
      Function to append a single entry to the existing state list.

      Note that if this is the first time the state is being appended to, the state will be initialized to an empty list before appending the new entry.

      Parameters:
      newState - - single list element to be appended
    • clear

      void clear()
      Function to remove the state for the current grouping key.
    • exists

      boolean exists()
      Function to check whether state exists for current grouping key or not.

      Returns:
      - true if state exists, false otherwise.
    • get

      scala.collection.Iterator<S> get()
      Function to get the list of elements in the state as an iterator. If the state does not exist, an empty iterator is returned.

      Note that it's always recommended to check whether the state exists or not by calling exists() before calling get().

      Returns:
      - an iterator of elements in the state if it exists, an empty iterator otherwise.
    • put

      void put(Object newState)
      Function to update the value of the state with a new list.

      Note that this will replace the existing value with the new value.

      Parameters:
      newState - - new list of elements