DataStructures
Interface Stack
- All Known Implementing Classes:
- StackArray, StackList
- public interface Stack
A last-in-first-out (LIFO) stack of objects.
- Author:
- Peter Williams
|
Method Summary |
boolean |
isEmpty()
Indicates the status of the stack. |
java.lang.Object |
pop()
Pops an item off the stack. |
void |
push(java.lang.Object item)
Pushes an item onto the stack. |
isEmpty
public boolean isEmpty()
- Indicates the status of the stack.
- Returns:
true if the stack is empty.
push
public void push(java.lang.Object item)
- Pushes an item onto the stack.
- Parameters:
item - the Object to be pushed.
pop
public java.lang.Object pop()
- Pops an item off the stack.
- Returns:
- the item most recently pushed onto the stack
- Throws:
NoSuchElementException - if the stack is empty.