public class BoundedQueue<E> extends java.util.AbstractCollection<E>
Constructor and Description |
---|
BoundedQueue(int capacity)
Constructs an empty queue.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E anObject)
Append an object at tail.
|
boolean |
isFull()
Checks whether this queue is full.
|
java.util.Iterator<E> |
iterator() |
E |
peek()
Gets object at head.
|
E |
remove()
Remove object at head.
|
int |
size() |
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
public BoundedQueue(int capacity)
capacity
- the maximum capacity of the queue
Precondition: capacity > 0
public E remove()
Precondition: size() > 0
public int size()
public boolean isFull()