DataStructures
Class StackArray<E>

java.lang.Object
  extended by DataStructures.StackArray<E>
Type Parameters:
E - the type of elements held in this stack
All Implemented Interfaces:
Stack<E>

public class StackArray<E>
extends java.lang.Object
implements Stack<E>

An array implementation of a stack

Author:
Peter Williams

Constructor Summary
StackArray()
          Creates an empty stack suitable for holding items of type E
 
Method Summary
 boolean isEmpty()
          Indicates the status of the stack.
 E pop()
          Pops an item off the stack.
 void push(E item)
          Pushes an item onto the stack.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackArray

public StackArray()
Creates an empty stack suitable for holding items of type E

Method Detail

isEmpty

public boolean isEmpty()
Description copied from interface: Stack
Indicates the status of the stack.

Specified by:
isEmpty in interface Stack<E>
Returns:
true if the stack is empty.

push

public void push(E item)
Description copied from interface: Stack
Pushes an item onto the stack.

Specified by:
push in interface Stack<E>
Parameters:
item - the item of type E to be pushed.

pop

public E pop()
Description copied from interface: Stack
Pops an item off the stack.

Specified by:
pop in interface Stack<E>
Returns:
the item most recently pushed onto the stack