T - The type that this queue contains.public class BoundedQueue<T> extends Object implements Iterable<T>
| Constructor and Description |
|---|
BoundedQueue(int limit)
Creates a new bounded queue.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(T value)
Adds a value to head of the queue, evicting the oldest item if the queue is at capacity.
|
void |
clear()
Removes all values from the queue.
|
Iterator<T> |
iterator() |
int |
size()
Returns the size of the queue.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic BoundedQueue(int limit)
limit - Maximum number of items that can be in the queue at any time.public void add(T value)
value - Value to add.public void clear()
public int size()