Rev 100 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
//Written by Ira Snyder
//11-03-2004
import java.util.LinkedList;
class Queue {
private LinkedList list;
public Queue( ) { list = new LinkedList(); } //create an empty queue
//put the item at the back of the queue
public void enqueue( Object o ) {
if( list.isEmpty() ) { list.add(o); }
else { list.addLast(o); }
}
//remove the item from the front of the queue
public Object dequeue() { return list.removeFirst(); }
//check if the queue is empty
public boolean isEmpty() { return list.isEmpty(); }
}