public class QueueStack<E>
extends java.lang.Object
We actually use an ArrayList to mimic a queue.
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<E> |
queue
The queue which is used to hold the stack entries.
|
Constructor and Description |
---|
QueueStack()
Create an empty stack.
|
protected java.util.ArrayList<E> queue
public boolean isEmpty()
public E peek()
EmptyQueueStackException
- when stack is empty.public E pop()
EmptyQueueStackException
- when stack is empty.public void push(E e)
e
- Element to add to stack.public int size()