    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 FIFO stack of objects.

Version:
  1.8, 31 Jan 1995
Author:
  Jonathan Payne

##

Stack()

##

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

##

Stack

      public Stack()

##

push

      public Object push(Object item)

  Pushes an item onto the stack.

pop

      public Object pop()

  Pops an item off the stack.
  Throws: EmptyStackException
    The stack is empty.

peek

      public Object peek()

  Peeks at the top of the stack.
  Throws: EmptyStackException
    The stack is empty.

empty

      public boolean empty()

  Returns true if the stack is empty.

search

      public int search(Object o)

  Sees if an object is on the stack.
  Returns:
    the distance from the top, or -1 if it isn't found

    All Packages    This Package    Previous    Next