public class ListStack extends List
Constructor and Description |
---|
ListStack()
Creates an empty Stack
|
Modifier and Type | Method and Description |
---|---|
boolean |
empty()
Tests for an empty Stack
|
java.lang.Object |
peek()
Returns the Object that is currently on top of the Stack.
|
java.lang.Object |
pop()
Removes and returns the Object that is currently on top of the Stack.
|
void |
push(java.lang.Object object)
Adds the given Object to the top of the Stack
|
int |
search(java.lang.Object object)
Searches for the given Object in the stack and returns it's position
relative to the top of the Stack.
|
public boolean empty()
public java.lang.Object peek() throws java.util.EmptyStackException
java.util.EmptyStackException
- when there are no
elements currently on the Stackpublic java.lang.Object pop() throws java.util.EmptyStackException
java.util.EmptyStackException
- when there are no
elements currently on the Stackpublic void push(java.lang.Object object)
public int search(java.lang.Object object)