Constructor and Description |
---|
Queue() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all items in the queue leaving an empty queue.
|
E |
dequeue()
Removes an item from the front of the Queue and returns it.
|
void |
enqueue(E item)
Adds an item to the rear of the queue.
|
private void |
expandCapacity() |
boolean |
isEmpty()
Returns true iff the Queue is empty.
|
E |
peek()
Returns the item at front of the Queue without removing it.
|
int |
size()
Returns the number of items in the Queue.
|
public void enqueue(E item)
public E dequeue()
dequeue
in interface QueueADT<E>
EmptyQueueException
- if the queue is empty.public E peek()
peek
in interface QueueADT<E>
EmptyQueueException
- if the queue is empty.public boolean isEmpty()
public void clear()
public int size()
private void expandCapacity()