Interface Cache<K,​V>


  • public interface Cache<K,​V>
    A cache from keys to values.
    • Method Detail

      • computeIfAbsent

        V computeIfAbsent​(K key,
                          Function<? super K,​? extends V> mappingFunction)
        Returns the cached value associated with the provided key. If no value is cached yet, computes the value using mappingFunction, stores the result, and returns it.
      • get

        V get​(K key)
        Returns the cached value associated with the provided key if present, or null otherwise.
      • put

        void put​(K key,
                 V value)
        Puts the value into the cache for the key.
      • remove

        void remove​(K key)
        Removes a value for key if present.