/** This program is intended to be used with the book "Java 6 -- What Do You Want To Do?"
 * by Steven P. Warr and is distributed free of charge and without and expectations of remuneration.
 * Chapter DAT   NOTE most programs begin with the title of the chapter in which
 * they are intended to be used.   Copyright 2010 Steven P. Warr All rights reserved
	Queue Example.
 */

import java.io.*;   		//needed so you can use the File class
import java.util.*;  		//needed for Lists
public class Dat04
{
	public static void main(String[ ] args) throws IOException
		{
            Queue <Character> c = new PriorityQueue <Character>();                                  
			c.offer('A');              // adds letter to the top of the Stack                     
			c.offer('B');                                              
			c.offer('C');                                              
			System.out.println(c);    		//[A, B, C]                                          
			System.out.println(c.poll());    // prints and removes C
			System.out.println(c);    		//[A, B]                                          
			c.offer('D');                                              
			c.offer('E');                                              
			System.out.println(c.poll());    // prints and removes E
			System.out.println(c);    		//[A, B, D]                                          
			c.offer('F');                                              
			
			char let = c.poll ();              
			char name = (Character)c.poll ();  // Wrapper class cast
			//System.out.println(let);                                              

			System.out.println(c);    		//[A, B]                                          
            
			for(char x:c)
			    System.out.println(x);   // for - each automates get 
            
        }

}
