Class java.util.Stack
All Packages    This Package    Previous    Next

Class java.util.Stack

java.lang.Object
   |
   +----java.util.Vector
           |
           +----java.util.Stack

public class Stack
extends Vector
A Last-In-First-Out(LIFO) stack of objects.
Version:
1.12, 08/11/95
Author:
Jonathan Payne

Constructor Index

 o Stack()

Method Index

 o empty()
Returns true if the stack is empty.
 o peek()
Peeks at the top of the stack.
 o pop()
Pops an item off the stack.
 o push(Object)
Pushes an item onto the stack.
 o search(Object)
Sees if an object is on the stack.

Constructors

 o Stack
  public Stack()

Methods

 o push
  public Object push(Object item)
Pushes an item onto the stack.
Parameters:
item - the item to be pushed on.

 o pop

  public Object pop()
Pops an item off the stack.
Throws: EmptyStackException
If the stack is empty.

 o peek

  public Object peek()
Peeks at the top of the stack.
Throws: EmptyStackException
If the stack is empty.

 o empty

  public boolean empty()
Returns true if the stack is empty.

 o search

  public int search(Object o)
Sees if an object is on the stack.
Parameters:
o - the desired object
Returns:
the distance from the top, or -1 if it is not found.


All Packages    This Package    Previous    Next