E - The type of Object that the queue will accept.public interface QueueInterface<E>
extends java.lang.Iterable<E>
| Modifier and Type | Method and Description |
|---|---|
E |
dequeue()
Retrieves and removes the element at the head of this queue.
|
E |
dequeue(int index)
Retrieves and removes the element at the specified index.
|
void |
enqueue(E e)
Adds the specified element into the stack if it is possible to do so immediately without
violating capacity restrictions, otherwise, throwing an IllegalStateException
if no space is currently available or NullPointerException if the specified element is null.
|
boolean |
isEmpty()
This method is called to determine if the queue is empty.
|
E |
peek()
Retrieves, but does not remove, the head of this queue.
|
void |
removeAll()
Removes all elements from the queue.
|
int |
size()
This method is called to obtain the count of elements in the list.
|
boolean isEmpty()
int size()
void enqueue(E e) throws java.lang.IllegalStateException, java.lang.NullPointerException
e - The element to add.java.lang.IllegalStateException - If the element cannot be added at this time due to capacity restrictions.java.lang.NullPointerException - If the specified element being added is null.E peek()
E dequeue()
E dequeue(int index) throws java.util.NoSuchElementException
index - The index of the element to be removed.java.util.NoSuchElementException - If the specified index is invalid.void removeAll()