All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.kvisco.util.QuickStack

com.kvisco.util.QuickStack

public class QuickStack
A representation of a Stack that does not use Synchronization. For compatibility this class supports the same methods as a java.util.Stack (JDK)

Author:
Keith Visco

Constructor Index

 o QuickStack()
Creates an empty Stack

Method Index

 o empty()
Tests for an empty Stack
 o iterator()
Returns an Iterator for this Stack.
 o peek()
Returns the Object that is currently on top of the Stack.
 o pop()
Removes and returns the Object that is currently on top of the Stack.
 o push(Object)
Adds the given Object to the top of the Stack
 o search(Object)
Searches for the given Object in the stack and returns it's position relative to the top of the Stack.
 o size()
Returns the number of items on the Stack

Constructors

 o QuickStack
 public QuickStack()
Creates an empty Stack

Methods

 o empty
 public boolean empty()
Tests for an empty Stack

Returns:
true if there are no elements on the stack, otherwise false.
 o iterator
 public Iterator iterator()
Returns an Iterator for this Stack. The iterator will iterate from the top of the stack, to the bottom

 o peek
 public Object peek() throws EmptyStackException
Returns the Object that is currently on top of the Stack. Unlike #pop the Object is not removed from the Stack.

Returns:
the Object that is currently the top of the stack
Throws: EmptyStackException
when there are no elements currently on the Stack
 o pop
 public Object pop() throws EmptyStackException
Removes and returns the Object that is currently on top of the Stack.

Returns:
the Object that is currently the top of the stack
Throws: EmptyStackException
when there are no elements currently on the Stack
 o push
 public void push(Object object)
Adds the given Object to the top of the Stack

 o search
 public int search(Object object)
Searches for the given Object in the stack and returns it's position relative to the top of the Stack.

 o size
 public int size()
Returns the number of items on the Stack

Returns:
the number of items on the Stack

All Packages  Class Hierarchy  This Package  Previous  Next  Index