Interface IComputable<K,V>

All Known Implementing Classes:
AbstractComputable, HardMemoizer, Memoizer, SimpleCache

public interface IComputable<K,V>
Interface to compute objects of type V identified by a key of type K
Author:
dirmeier
  • Method Summary

    Modifier and Type
    Method
    Description
    compute(K key)
    Compute an object of type V identified by the key of type K
    Class<? super V>
    Getting the Class of the value this computable produces.
    static <K, V> IComputable<K,V>
    of(Class<? super V> valueClass, Function<K,V> function)
    Creates a new IComputable for the given value class using the given Function to compute the values from keys.
  • Method Details

    • compute

      V compute(K key) throws InterruptedException
      Compute an object of type V identified by the key of type K
      Parameters:
      key - the key to identify the object
      Returns:
      the computed Object of type V
      Throws:
      InterruptedException - When computation was interrupted
    • getValueClass

      Class<? super V> getValueClass()
      Getting the Class of the value this computable produces.
    • of

      static <K, V> IComputable<K,V> of(Class<? super V> valueClass, Function<K,V> function)
      Creates a new IComputable for the given value class using the given Function to compute the values from keys.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      valueClass - the class of the values
      function - the function to compute a value from a key
      Returns:
      a new IComputable