java.util
public class Stack<T> extends Vector<T>
Constructor Summary | |
---|---|
Stack()
This constructor creates a new Stack, initially empty |
Method Summary | |
---|---|
boolean | empty()
Tests if the stack is empty.
|
T | peek()
Returns the top Object on the stack without removing it.
|
T | pop()
Pops an item from the stack and returns it. |
T | push(T item)
Pushes an Object onto the top of the stack. |
int | search(Object o)
Returns the position of an Object on the stack, with the top
most Object being at position 1, and each Object deeper in the
stack at depth + 1.
|
Returns: true if the stack contains no items, false otherwise
Returns: the top Object on the stack
Throws: EmptyStackException if the stack is empty
Returns: the Object popped from the stack
Throws: EmptyStackException if the stack is empty
Parameters: item the Object to push onto the stack
Returns: the Object pushed onto the stack
See Also: addElement
Parameters: o The object to search for
Returns: The 1 based depth of the Object, or -1 if the Object is not on the stack