@@ -0,0 +1,2132 @@
+package collections;%0A%0Aimport java.util.ArrayDeque;%0Aimport java.util.Deque;%0A%0A/**%0A * - Queue %0A * an interface extending Collection interface%0A * stores ordered elements in FIFO (first-in first-out)%0A * %0A * - Deque%0A * an interface extending Queue interface%0A * stores ordered elements in a way that elements can be added into both front and back%0A * %0A * - LinkedList%0A * a concrete class implementing both Deque and List interfaces%0A * %0A * - ArrayDeque%0A * a concrete class implementing Deque interface%0A * double-ended queue and more efficient than LinkedList%0A * %0A * boolean %09offer(E e)%09- add element to back of queue%0A * boolean %09add(E e) %09- add element to back of queue or throws an EXCEPTION (from Collection)%0A * void%09%09push(E e)%09- add element to front of queue or throws an EXCEPTION (from Deque)%0A * %0A * E %09%09element()%09- return front element of queue or throws an EXCEPTION if queue is empty%0A * E%09%09peek()%09%09- return front element of queue or null if queue is empty%0A * %0A * E %09%09poll()%09%09- remove/return front element of queue or null if queue is empty%0A * E%09%09pop()%09%09- remove/return front element of queue or throws an EXCEPTION if queue is empty (from Deque)%0A * E %09%09remove()%09- remove/return front element of queue or throws an EXCEPTION if queue is empty%0A * boolean %09remove(E e)%09- remove a given element of queue, and throws an EXCEPTION if queue is empty (from Collection)%0A * %0A */%0Apublic class AboutQueue %7B%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Deque%3CInteger%3E queue = new ArrayDeque%3C%3E();%0A%09%09queue.add(11);%0A%09%09queue.add(12);%0A%09%09queue.add(13);%0A%09%09queue.add(14);%0A%09%09queue.add(10);%0A%09%09queue.push(9);%0A%09%09queue.offer(8);%0A%09%09%0A%09%09System.out.println(queue);%09// %5B9, 11, 12, 13, 14, 10, 8%5D%0A%09%09%0A%09%09System.out.println(queue.element());%09// 9%0A%09%09System.out.println(queue.remove(13));%09//%09true%0A%09%09System.out.println(queue.poll());%09%09// 9%0A%09%09System.out.println(queue.remove());%09%09// 11%0A%09%09System.out.println(%22peeked: %22 + queue.peek());%09// peeked: 12%0A%09%09System.out.println(queue.element());%09// 12%0A%09%09System.out.println(queue.pop());%09%09// 12%0A%09%09%0A%09%09System.out.println(queue);%09// %5B14, 10, 8%5D%0A%09%7D%0A%7D%0A/** Output:%0A%5B9, 11, 12, 13, 14, 10, 8%5D%0A9%0Atrue%0A9%0A11%0Apeeked: 12%0A12%0A12%0A%5B14, 10, 8%5D%0A */%0A%0A

Create AboutQueue.java