codeblockutil
Class LRUCache<K,V>

java.lang.Object
  extended by codeblockutil.LRUCache<K,V>

public class LRUCache<K,V>
extends java.lang.Object

This class implements a Least Recently Used cache that stores arbitrary key/value pairs.


Constructor Summary
LRUCache(int _capacity)
           
 
Method Summary
 V get(K key)
           
 void put(K key, V value)
          Adds an entry to the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LRUCache

public LRUCache(int _capacity)
Method Detail

get

public V get(K key)
Returns:
the value associated with key, if it is in the cache (or null otherwise)

put

public void put(K key,
                V value)
Adds an entry to the cache.