|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<T> org.apache.wiki.util.TimedCounterList<T>
T
- The class you wish to store herepublic class TimedCounterList<T>
Provides a List in which all items store their addition time. This can then be used to clean the list from old items.
This class is thread-safe - all modifications are blocking, but reading is non-blocking (unless a write is ongoing).
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
TimedCounterList()
|
Method Summary | |
---|---|
void |
add(int index,
T element)
|
void |
cleanup(long maxage)
Performs a cleanup of all items older than maxage. |
int |
count(T obj)
Returns the count how many times this object is available in this list, using equals(). |
T |
get(int index)
|
long |
getAddTime(int index)
Returns the time when this particular item was added on the list. |
T |
remove(int index)
|
T |
set(int index,
T element)
|
int |
size()
|
Methods inherited from class java.util.AbstractList |
---|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public TimedCounterList()
Method Detail |
---|
public T set(int index, T element)
set
in interface List<T>
set
in class AbstractList<T>
public T get(int index)
get
in interface List<T>
get
in class AbstractList<T>
public int size()
size
in interface Collection<T>
size
in interface List<T>
size
in class AbstractCollection<T>
public void add(int index, T element)
add
in interface List<T>
add
in class AbstractList<T>
public T remove(int index)
remove
in interface List<T>
remove
in class AbstractList<T>
public int count(T obj)
obj
- The object to count.
public void cleanup(long maxage)
maxage
- The maximum age in milliseconds after an item is removed.public long getAddTime(int index)
index
- The index of the object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |