org.locomotive.util.data
Class Stack

java.lang.Object
  |
  +--org.locomotive.util.data.Stack

public class Stack
extends java.lang.Object

This class contains a basic implementation of a stack using arrays At this point, resizing the array will simply double the present size of the array. The main benefit of this over java.util.Stack is that it isn't synchronized.


Constructor Summary
Stack()
          Creates a stack with an initial size of 20
Stack(int initialSize)
          Creates a stack whose initial size is the specified parameter
 
Method Summary
 boolean isEmpty()
          returns true if empty, false otherwise
 java.lang.Object pop()
          pops an item off of the stack.
 void push(java.lang.Object obj)
          pushes an item onto the stack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stack

public Stack()
Creates a stack with an initial size of 20

Stack

public Stack(int initialSize)
Creates a stack whose initial size is the specified parameter
Method Detail

push

public void push(java.lang.Object obj)
pushes an item onto the stack

pop

public java.lang.Object pop()
pops an item off of the stack. Returns null if the stack is empty

isEmpty

public boolean isEmpty()
returns true if empty, false otherwise