public interface Stack<T>
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all items from the stack.
|
boolean |
isEmpty()
Returns whether the stack is empty.
|
T |
peek()
Returns the item on top of the stack, without removing it.
|
T |
pop()
Removes and returns the item from the top of this stack.
|
void |
push(T item)
Adds an item to the top of this stack.
|
void push(T item)
item
- The item to add.T pop()
java.util.EmptyStackException
- if stack is empty.T peek()
java.util.EmptyStackException
- if stack is empty.boolean isEmpty()
void clear()