Class VectorStackSolution

java.lang.Object
  |
  +--VectorStackSolution
All Implemented Interfaces:
IStack

public class VectorStackSolution
extends Object
implements IStack

IStack implementation using a Java Vector to hold its elements.


Field Summary
protected  Vector elements
          Vector used to hold the elements on this.
 
Constructor Summary
VectorStackSolution()
          Constructs a new Java stack.
 
Method Summary
 boolean isEmpty()
          Returns whether or not this is empty.
 Object pop()
          Removes and returns the top object on this.
 void push(Object anObject)
          Pushes the given object onto this.
 int size()
          Returns the number of objects on this.
 Object top()
          Returns the top object on this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

protected Vector elements
Vector used to hold the elements on this.

Constructor Detail

VectorStackSolution

public VectorStackSolution()
Constructs a new Java stack.

Method Detail

push

public void push(Object anObject)
Pushes the given object onto this.

Specified by:
push in interface IStack
Parameters:
anObject - object to push

pop

public Object pop()
Removes and returns the top object on this.

Specified by:
pop in interface IStack

top

public Object top()
Returns the top object on this.

Specified by:
top in interface IStack

size

public int size()
Returns the number of objects on this.

Specified by:
size in interface IStack

isEmpty

public boolean isEmpty()
Returns whether or not this is empty.

Specified by:
isEmpty in interface IStack