|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.egothor.cache.fifo.FifoList<T>
T
- items stored in the listpublic class FifoList<T>
Represents a FIFO (First-In First-Out) list.
Constructor Summary | |
---|---|
FifoList(int intendedCapacity)
Constructor for the FifoList object. |
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()
Returns the number of items stored in the list. |
java.lang.String |
toString()
Returns a text representation of the list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FifoList(int intendedCapacity)
intendedCapacity
- maximum number of items this list can hold (but can be exceeded whenever needed)Method Detail |
---|
public T getOldest()
getOldest
in interface List<T>
public T getNewest()
getNewest
in interface List<T>
public boolean add(T entry)
add
in interface List<T>
entry
- item to add to the list
public boolean remove(T entry)
remove
in interface List<T>
entry
- item to remove from the list
public boolean contains(T entry)
contains
in interface List<T>
entry
- item to check
public void clear()
clear
in interface List<T>
public int size()
size
in interface List<T>
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |