Interface StateHolder<K,V>

Type Parameters:
K - type of Keys
V - type of Values

public interface StateHolder<K,V>
A Map like structure that can hold key value mappings.
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves all the entries in the StateHolder as a Set of Map.Entry instances.
    get(K key)
    Retrieves the value mapped to the given key
    putIfAbsent(K key, V value)
    If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value.
    boolean
    remove(K key, V value)
    Removes the entry for a key only if currently mapped to a given value.
  • Method Details

    • putIfAbsent

      V putIfAbsent(K key, V value)
      If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value.
      Parameters:
      key - a key
      value - a value
      Returns:
      the previous value associated with the specified key, or null if there was no mapping for the key.
    • get

      V get(K key)
      Retrieves the value mapped to the given key
      Parameters:
      key - a key
      Returns:
      the value mapped to the key
    • remove

      boolean remove(K key, V value)
      Removes the entry for a key only if currently mapped to a given value.
      Parameters:
      key - a key with which the specified value is associated
      value - value expected to be associated with the specified key
      Returns:
      true if the value was removed
    • entrySet

      Set<Map.Entry<K,V>> entrySet()
      Retrieves all the entries in the StateHolder as a Set of Map.Entry instances.
      Returns:
      the set of this StateHolder mappings