org.egothor.cache.lru
Class LruList<T>

java.lang.Object
  extended by org.egothor.cache.fifo.FifoList<T>
      extended by org.egothor.cache.lru.LruList<T>
Type Parameters:
T - items stored in the list
All Implemented Interfaces:
List<T>

public class LruList<T>
extends FifoList<T>

Represents a LRU (Least Recently Used) list.


Constructor Summary
LruList(int intendedCapacity)
          Constructor for the LruList object.
 
Method Summary
 boolean update(T entry)
          Removes the item from the current position and adds it to the newest (MRU) position.
 
Methods inherited from class org.egothor.cache.fifo.FifoList
add, clear, contains, getNewest, getOldest, remove, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LruList

public LruList(int intendedCapacity)
Constructor for the LruList object.

Parameters:
intendedCapacity - maximum number of items this list can hold (but can be exceeded whenever needed)
Method Detail

update

public boolean update(T entry)
Removes the item from the current position and adds it to the newest (MRU) position.

Parameters:
entry - item to update
Returns:
true, if the item was successfully updated, false otherwise