Build 1.0_r1(from source)

java.util
Class Stack<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<E>
              extended by java.util.Stack<E>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess

public class Stack<E>
extends Vector<E>

Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables users to pop and push onto the stack, including null objects. There is no limit to the size of the stack

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Stack()
          Constructs a stack with the default size of Vector.
 
Method Summary
 boolean empty()
          Determines if the stack is empty or not.
 E peek()
          Returns the element at the top of the stack without removing it.
 E pop()
          Returns the element at the top of the stack and removes it.
 E push(E object)
          Pushes the object from the parameter onto the top of the stack.
 int search(Object o)
          Returns the index of the first occurrence of the object.
 
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.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

Stack

public Stack()
Constructs a stack with the default size of Vector.

Method Detail

empty

public boolean empty()
Determines if the stack is empty or not.

Returns:
true if the stack is empty, false otherwise

peek

public E peek()
Returns the element at the top of the stack without removing it.

Returns:
the element at the top of the Stack
Throws:
EmptyStackException - when empty() is true
See Also:
pop()

pop

public E pop()
Returns the element at the top of the stack and removes it.

Returns:
the element at the top of the stack.
Throws:
EmptyStackException - when empty() is true
See Also:
peek(), push(E)

push

public E push(E object)
Pushes the object from the parameter onto the top of the stack.

Parameters:
object - The object to be added to the stack
Returns:
the object argument
See Also:
peek(), pop()

search

public int search(Object o)
Returns the index of the first occurrence of the object.

Parameters:
o - the object to be searched
Returns:
the index of the first occurrence of the object

Build 1.0_r1(from source)

Please submit a feedback, bug or feature