Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.util

Class Stack

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


public class Stack

extends Vector

Constructor Summary

Stack()

This constructor creates a new Stack, initially empty

Method Summary

synchronized booleanempty()

Tests if the stack is empty.
synchronized java.lang.Objectpeek()

Returns the top Object on the stack without removing it.
synchronized java.lang.Objectpop()

Pops an item from the stack and returns it.
java.lang.Objectpush(java.lang.Object item)

Pushes an Object onto the top of the stack.
synchronized intsearch(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.

Constructor Details

Stack

public Stack()

This constructor creates a new Stack, initially empty


Method Details

empty

public synchronized boolean empty()

Tests if the stack is empty.

Returns:


peek

public synchronized Object peek()

Returns the top Object on the stack without removing it.

Returns:

Throws:


pop

public synchronized Object pop()

Pops an item from the stack and returns it. The item popped is removed from the Stack.

Returns:

Throws:


push

public Object push(java.lang.Object item)

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

Parameters:

Returns:

See Also:


search

public synchronized 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.

Parameters:

Returns: