Class LruCache<K,​V>

  • All Implemented Interfaces:
    Cache<K,​V>

    public final class LruCache<K,​V>
    extends java.lang.Object
    implements Cache<K,​V>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<K,​V> cache  
    • Constructor Summary

      Constructors 
      Constructor Description
      LruCache​(int maxCapacity)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(K key)  
      V get​(K key)  
      void put​(K key, V value)  
      long size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cache

        private final java.util.Map<K,​V> cache
    • Constructor Detail

      • LruCache

        public LruCache​(int maxCapacity)
    • Method Detail

      • containsKey

        public boolean containsKey​(K key)
        Specified by:
        containsKey in interface Cache<K,​V>
      • get

        public V get​(K key)
        Specified by:
        get in interface Cache<K,​V>
      • put

        public void put​(K key,
                        V value)
        Specified by:
        put in interface Cache<K,​V>
      • size

        public long size()