org.egothor.cache
Interface List<T>

Type Parameters:
T - type of the stored item
All Known Implementing Classes:
FifoList, LruList

public interface List<T>

Represents an interface for every class that behaves like a list of items.


Method Summary
 boolean add(T entry)
          Adds an item to the list.
 void clear()
          Removes all items from the list.
 boolean contains(T entry)
          Checks whether an item is present in the list.
 T getNewest()
          Gets the item that has been the shortest time in the list.
 T getOldest()
          Gets the item that has been the longest time in the list.
 boolean remove(T entry)
          Removes an item from the list.
 int size()
          Gets the number of items in the list.
 

Method Detail

getOldest

T getOldest()
Gets the item that has been the longest time in the list.

Returns:
oldest item

getNewest

T getNewest()
Gets the item that has been the shortest time in the list.

Returns:
newest item

add

boolean add(T entry)
Adds an item to the list.

Parameters:
entry - item to add to the list
Returns:
true, if the item was successfully added to list, false otherwise

remove

boolean remove(T entry)
Removes an item from the list.

Parameters:
entry - item to remove from the list
Returns:
true, if the item was successfully removed from list, false otherwise

contains

boolean contains(T entry)
Checks whether an item is present in the list.

Parameters:
entry - item to check
Returns:
true, if the item is in the list, false otherwise

clear

void clear()
Removes all items from the list.


size

int size()
Gets the number of items in the list.

Returns:
number of items in the list