import java.util.LinkedList;

public class ListQueue implements Queue 
{ 
    public ListQueue()
    {
        list = new LinkedList();
    } 

    public void enqueue(Object x)
    {
        list.addLast(x);
    }
    
    public Object dequeue()
    {
        return list.removeFirst();
    }
    
    public Object peekFront()
    {
        return list.getFirst();
    }
    
    public boolean isEmpty()
    {
        return list.size() == 0;
    }
    
    public String toString()	// could just return list.toString();
    {
    	String result = "[";
    	
    	for (int i = 0; i < list.size(); i++)
    	{
    		result += list.get(i);
    		if (i < list.size()-1)
    			result += ", ";
    	}
    	
    	return result += "]";
    }

    private LinkedList list; 
} 
