public interface Stack<E>
EmptyStackException
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
Return whether the stack is empty.
|
E |
pop()
Remove the top element from the stack.
|
void |
push(E element)
Insert an element at the top of the stack.
|
int |
size()
Return the number of elements in the stack.
|
E |
top()
Inspect the element at the top of the stack.
|
boolean isEmpty()
E pop() throws EmptyStackException
EmptyStackException
- if the stack is empty.void push(E element)
element
- to be inserted.int size()
E top() throws EmptyStackException
EmptyStackException
- if the stack is empty.