T
- The type of data that the queue stores.public interface Queue<T>
Modifier and Type | Interface and Description |
---|---|
static class |
Queue.EmptyQueueException
An exception to indicate that the queue is empty on dequeue or peek.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all items from the queue.
|
T |
dequeue()
Removes an item from the front of the queue and returns it.
|
void |
enqueue(T item)
Adds the given item to the back of the queue.
|
boolean |
isEmpty()
Returns true if the queue is empty.
|
T |
peek()
Returns the item at the front of the queue, without removing it.
|
void enqueue(T item)
T dequeue()
Queue.EmptyQueueException
- if the queue is empty.T peek()
Queue.EmptyQueueException
- if the queue is empty.boolean isEmpty()
void clear()