Package org.jgroups.util
Class BoundedList<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- java.util.concurrent.ConcurrentLinkedQueue<T>
-
- org.jgroups.util.BoundedList<T>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.Queue<T>
public class BoundedList<T> extends java.util.concurrent.ConcurrentLinkedQueue<T>
A bounded subclass of LinkedList, oldest elements are removed once max capacity is exceeded. Note that this class is not synchronized (like LinkedList). Don't use this for high performance, as size() has a linear cost. But in most scenarios, this class is used for maintaining a history, e.g. of digests or views, so perf is not critical.- Author:
- Bela Ban Nov 20, 2003
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BoundedList()
BoundedList(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T obj)
Adds an element at the tail.boolean
addIfAbsent(T obj)
T
removeFromHead()
-
Methods inherited from class java.util.concurrent.ConcurrentLinkedQueue
addAll, clear, contains, forEach, isEmpty, iterator, offer, peek, poll, remove, removeAll, removeIf, retainAll, size, spliterator, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-