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

Class java.util.Stack

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

public class Stack
extends Vector
The Stack class represents a last-in-first-out (LIFO) stack of objects.

Version:
1.17, 07/01/98
Author:
Jonathan Payne
Since:
JDK1.0

Constructor Index

 o java.util.Stack()

Method Index

 o empty()
Tests if this stack is empty.
 o peek()
Looks at the object at the top of this stack without removing it from the stack.
 o pop()
Removes the object at the top of this stack and returns that object as the value of this function.
 o push(Object)
Pushes an item onto the top of this stack.
 o search(Object)
Returns where an object is on this stack.

Constructors

 o Stack
public Stack()

Methods

 o empty
public boolean empty()
Tests if this stack is empty.

Returns:
true if this stack is empty; false otherwise.
Since:
JDK1.0
 o peek
public synchronized java.lang.Object peek()
Looks at the object at the top of this stack without removing it from the stack.

Returns:
the object at the top of this stack.
Throws: EmptyStackException
if this stack is empty.
Since:
JDK1.0
 o pop
public synchronized java.lang.Object pop()
Removes the object at the top of this stack and returns that object as the value of this function.

Returns:
The object at the top of this stack.
Throws: EmptyStackException
if this stack is empty.
Since:
JDK1.0
 o push
public java.lang.Object push(Object item)
Pushes an item onto the top of this stack.

Parameters:
item - the item to be pushed onto this stack.
Returns:
the item argument.
Since:
JDK1.0
 o search
public synchronized int search(Object o)
Returns where an object is on this stack.

Parameters:
o - the desired object.
Returns:
the distance from the top of the stack where the object is] located; the return value -1 indicates that the object is not on the stack.
Since:
JDK1.0

All Packages  Class Hierarchy  This Package  Previous  Next  Index