Class Cache<T,​R>

  • All Implemented Interfaces:
    Function<T,​R>

    public class Cache<T,​R>
    extends Object
    implements Function<T,​R>
    • Constructor Detail

      • Cache

        public Cache​(Function<T,​R> function)
        Creates an empty cache
        Parameters:
        function -
    • Method Detail

      • apply

        public R apply​(T input)
        Specified by:
        apply in interface Function<T,​R>
      • put

        public R put​(T input,
                     R output)
      • remove

        public R remove​(T input)
      • size

        public int size()
        Returns:
        the cache size
        See Also:
        Map.size()
      • setFunction

        public void setFunction​(Function<T,​R> function)
        Sets the function which is used for future calls, but does not recompute already cached elements.
        Parameters:
        function -