Rev 100 | Blame | Compare with Previous | Last modification | View Log | RSS feed
//Written by Ira Snyder//11-03-2004//License: Public Domain (added 07-11-2005)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 queuepublic void enqueue( Object o ) {if( list.isEmpty() ) { list.add(o); }else { list.addLast(o); }}//remove the item from the front of the queuepublic Object dequeue() { return list.removeFirst(); }//check if the queue is emptypublic boolean isEmpty() { return list.isEmpty(); }}