T
- The class you wish to store herepublic class TimedCounterList<T> extends AbstractList<T>
This class is thread-safe - all modifications are blocking, but reading is non-blocking (unless a write is ongoing).
modCount
Constructor and Description |
---|
TimedCounterList() |
Modifier and Type | Method and Description |
---|---|
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() |
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
public T get(int index)
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)
public T remove(int index)
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.Copyright © 2001-2018 The Apache Software Foundation. All rights reserved.