| Modifier and Type | Field and Description |
|---|---|
| private final int | capacity
The maximum number of elements that can be present. |
| private final Queue | data
Queue that never holds more than |
| Access | Constructor and Description |
|---|---|
| pack-priv | BoundedQueue(int
the maximum number of elements the queue can hold capacity)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public Iterator | iterator()
Implements abstract java. Implements java. |
| public boolean | offer(T
the element to add element)Implements java. |
| public T | peek()
Implements java. null if this queue is empty.
|
| public T | poll()
Implements java. null if this queue is empty.
|
| public int | size()
Implements abstract java. Implements java. |
| capacity | back to summary |
|---|---|
| private final int capacity The maximum number of elements that can be present. | |
| data | back to summary |
|---|---|
| private final Queue<T> data Queue that never holds more than | |
| BoundedQueue | back to summary |
|---|---|
| pack-priv BoundedQueue(int capacity) Creates a new
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements abstract java. Implements java. Doc from java. Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee). | |
| offer | back to summary |
|---|---|
| public boolean offer(T element) Implements java. Doc from java. Inserts the specified element into this queue if it is possible to do
so immediately without violating capacity restrictions.
When using a capacity-restricted queue, this method is generally
preferable to
| |
| peek | back to summary |
|---|---|
| public T peek() Implements java. Doc from java. Retrieves, but does not remove, the head of this queue,
or returns
| |
| poll | back to summary |
|---|---|
| public T poll() Implements java. Doc from java. Retrieves and removes the head of this queue,
or returns
| |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this collection. If this collection
contains more than
| |