Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.util
Class Stack  view Stack download Stack.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended byjava.util.Stack
All Implemented Interfaces:
java.lang.Cloneable, Collection, java.lang.Iterable, List, RandomAccess, java.io.Serializable

public class Stack
extends Vector


Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
private static long serialVersionUID
          Compatible with JDK 1.0+.
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Stack()
          This constructor creates a new Stack, initially empty
 
Method Summary
 boolean empty()
          Tests if the stack is empty.
 java.lang.Object peek()
          Returns the top Object on the stack without removing it.
 java.lang.Object pop()
          Pops an item from the stack and returns it.
 java.lang.Object push(java.lang.Object item)
          Pushes an Object onto the top of the stack.
 int search(java.lang.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.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.util.AbstractCollection
equals, hashCode, removeAllInternal, retainAllInternal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with JDK 1.0+.

See Also:
Constant Field Values
Constructor Detail

Stack

public Stack()
This constructor creates a new Stack, initially empty

Method Detail

push

public java.lang.Object push(java.lang.Object item)
Pushes an Object onto the top of the stack. This method is effectively the same as addElement(item).


pop

public java.lang.Object pop()
Pops an item from the stack and returns it. The item popped is removed from the Stack.


peek

public java.lang.Object peek()
Returns the top Object on the stack without removing it.


empty

public boolean empty()
Tests if the stack is empty.


search

public int search(java.lang.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.