- java.lang.Object
-
- ch.bind.philib.util.LruList<E>
-
-
Constructor Summary
Constructors Constructor Description LruList(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Eadd(E node)Add a newLruNodeto the head of the LRU.intcapacity()voidclear()booleanhasSpace()voidmoveToHead(E node)voidremove(E node)EremoveTail()intsize()
-
-
-
Method Detail
-
add
public E add(E node)
Add a newLruNodeto the head of the LRU.- Parameters:
node- The new head of theLruList.- Returns:
nullif the the size after adding the newLruNodedoes not exceed this list'scapacity. Otherwise the list will remove the tail (the element which wasn't accessed for the longest amount of time) and return it.
-
remove
public void remove(E node)
-
removeTail
public E removeTail()
-
moveToHead
public void moveToHead(E node)
-
clear
public void clear()
-
size
public int size()
-
capacity
public int capacity()
-
hasSpace
public boolean hasSpace()
-
-