public class LLQueueUser // test out the LLQueue with two example Queues, one storing Strings, the other Integers { @SuppressWarnings("unchecked") public static void main(String[] args) { try { LLQueue q1=new LLQueue<>(); q1.enqueue("Frank"); q1.enqueue("Gail"); q1.enqueue("Ian"); q1.enqueue("Mike"); System.out.println(q1.dequeue()); q1.enqueue("Ruth"); q1.enqueue("Suzie"); System.out.println(q1.peek()); q1.enqueue("Ike"); q1.enqueue("Thana"); while(!q1.isEmpty()) System.out.println(q1.dequeue()); q1.dequeue(); // stack is now empty, this will throw an exception } catch(QueueEmptyException e) { System.out.println(e); } try { LLQueue q2=new LLQueue<>(); for(int i=0;i<10;i++) { if(i==3||i==6||i==8) System.out.println(q2.dequeue()); else q2.enqueue(new Integer(i)); } while(!q2.isEmpty()) System.out.println(q2.dequeue()); q2.peek(); // Queue is now empty, this will throw an exception } catch(QueueEmptyException e) { System.out.println(e); } } }