Class QueueList

java.lang.Object
  extended by QueueList

public class QueueList
extends Object

Implements a simple queue using a list

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
QueueList()
          No argument constructor
 
Method Summary
 boolean empty()
          Empty?
static void main(String[] args)
          Main method for testing
 Object peek()
          Peek at, but don't remove, top (first) of queue
 Object pop()
          Pop an object from the Queue
 void push(Object element)
          Push an object onto the Queue
 int size()
          Return the size of a queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueList

public QueueList()
No argument constructor

Method Detail

push

public void push(Object element)
Push an object onto the Queue

Parameters:
element - the element to add to the queue

peek

public Object peek()
Peek at, but don't remove, top (first) of queue

Returns:
the first element in the queue

pop

public Object pop()
Pop an object from the Queue

Returns:
the top object from the queue (and remove it)

size

public int size()
Return the size of a queue

Returns:
the number of elements in the queue

empty

public boolean empty()
Empty?

Returns:
true if no elements in the queue, else false

main

public static void main(String[] args)
Main method for testing