Class LinkedListQueue<E>

java.lang.Object
  extended by AbstractQueue<E>
      extended by LinkedListQueue<E>
All Implemented Interfaces:
Queue<E>

public class LinkedListQueue<E>
extends AbstractQueue<E>

Implements a simple queue using a linked list

Author:
Mark Guzdial, Barb Ericson

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

Constructor Detail

LinkedListQueue

public LinkedListQueue()
No argument constructor

Method Detail

push

public void push(E element)
Push an element onto the tail of the Queue

Specified by:
push in interface Queue<E>
Specified by:
push in class AbstractQueue<E>
Parameters:
element - the element to add to the queue

peek

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

Specified by:
peek in interface Queue<E>
Specified by:
peek in class AbstractQueue<E>
Returns:
the first object in the queue

pop

public E pop()
Pop an object from the Queue

Specified by:
pop in interface Queue<E>
Specified by:
pop in class AbstractQueue<E>
Returns:
the top object from the queue (and remove it)

size

public int size()
Return the size of a queue

Specified by:
size in interface Queue<E>
Specified by:
size in class AbstractQueue<E>
Returns:
the number of elements in the queue

main

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