Class MemoizedFunctionImpl<I,O>

java.lang.Object
org.aksw.commons.util.memoize.MemoizedFunctionImpl<I,O>
All Implemented Interfaces:
Function<I,O>, Memoized<I,O>, MemoizedFunction<I,O>

public class MemoizedFunctionImpl<I,O> extends Object implements MemoizedFunction<I,O>
  • Field Details

    • cache

      protected Map<I,O> cache
    • delegate

      protected Function<I,O> delegate
  • Constructor Details

    • MemoizedFunctionImpl

      public MemoizedFunctionImpl(Function<I,O> delegate, Map<I,O> cache)
  • Method Details

    • getCache

      public Map<I,O> getCache()
      Description copied from interface: Memoized
      Return a reference or copy to the memoized entries
      Specified by:
      getCache in interface Memoized<I,O>
    • clearCache

      public void clearCache()
      Description copied from interface: Memoized
      Clear the cache
      Specified by:
      clearCache in interface Memoized<I,O>
    • apply

      public O apply(I obj)
      Specified by:
      apply in interface Function<I,O>
    • create

      public static <I,O> MemoizedFunction<I,O> create(Function<I,O> delegate)
      Create with backing by a ConcurrentHashMap
    • createNonConcurrent

      public static <I,O> MemoizedFunction<I,O> createNonConcurrent(Function<I,O> delegate)
      Create with backing by a HashMap