Class LRUCache<K,​V>

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

    public class LRUCache<K,​V>
    extends java.lang.Object
    implements Cache<K,​V>
    • Constructor Summary

      Constructors 
      Constructor Description
      LRUCache​(int size)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      java.util.Optional<V> get​(K key)  
      boolean isEmpty()  
      boolean put​(K key, V value)  
      int size()  
      • Methods inherited from class java.lang.Object

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

      • LRUCache

        public LRUCache​(int size)
    • Method Detail

      • put

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

        public java.util.Optional<V> get​(K key)
        Specified by:
        get in interface Cache<K,​V>
      • size

        public int size()
        Specified by:
        size in interface Cache<K,​V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Cache<K,​V>
      • clear

        public void clear()
        Specified by:
        clear in interface Cache<K,​V>