public interface StackADT<T>
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
Returns true iff if this Stack is empty
|
T |
peek()
Returns the element from the top of Stack,
without removing it from the stack.
|
T |
pop()
Returns and removes the element from the top of Stack,
If the stack is empty, throws java.util.EmptyStackException
|
void |
push(T data)
Add the data item to top of the Stack.
|
StackADT<T> |
reverse()
Creates a new Stack with the items of this stack
in the reverse order.
|
boolean isEmpty()
void push(T data) throws java.lang.IllegalArgumentException
data
- the data item to add to top of stackjava.lang.IllegalArgumentException
- if data is nullT peek() throws java.util.EmptyStackException
java.util.EmptyStackException
- if called on empty stackT pop() throws java.util.EmptyStackException
java.util.EmptyStackException
- if called with no items in the stack