Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. //import java.util.*;
  2. /**
  3.  * Write a description of class Queue here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class Queue extends LinkedList
  9. {
  10.    public Queue()
  11.    {}
  12.  
  13.    public void enqueue(Object elem)
  14.    {
  15.        insertAtBack(elem);
  16.    }
  17.    public Object dequeue()// throws
  18.    {
  19.       Object temp = head.getData();
  20.        if(isEmpty())
  21.        {
  22.            System.err.println("Queue is Empty, can't remove element.");
  23.        }
  24.        else
  25.        {
  26.        
  27.         removeFromFront();
  28.        
  29.       }
  30.       return temp;
  31.     }
  32. }
  33.    /*public boolean isEmpty(){
  34.        return isEmpty();
  35.    }*/ //already within class LinkedList