public class Stack extends Vector
capacityIncrement, elementCount, elementData
Constructor and Description |
---|
Stack()
This constructor creates a new Stack, initially empty
|
Modifier and Type | Method and Description |
---|---|
boolean |
empty()
Tests if the stack is empty.
|
Object |
peek()
Returns the top Object on the stack without removing it.
|
Object |
pop()
Pops an item from the stack and returns it.
|
Object |
push(Object 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.
|
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, firstElement, get, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, setElementAt, setSize, size, toArray, toArray, toString, trimToSize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode
public Object push(Object item)
item
- the Object to push onto the stackVector.addElement(Object)
public Object pop()
EmptyStackException
- if the stack is emptypublic Object peek()
EmptyStackException
- if the stack is emptypublic boolean empty()
public int search(Object o)
o
- The object to search for