@@ -0,0 +1,615 @@
+import java.util.*;%0A%0Apublic class Problem3_5 %7B%0A  public static void main(String%5B%5D args) %7B%0A    MyQueue%3CInteger%3E q = new MyQueue%3C%3E();%0A    for (int i = 0; i %3C 5; i++) q.add(i);%0A    for (int i = 0; i %3C 5; i++) System.out.println(q.poll() + %22 should be %22 + i);%0A  %7D%0A%0A  public static class MyQueue%3CT%3E %7B%0A    private LinkedList%3CT%3E a = new LinkedList%3C%3E();%0A    private LinkedList%3CT%3E b = new LinkedList%3C%3E();%0A%0A    public T poll() %7B%0A      while (!a.isEmpty()) b.push(a.pop());%0A      T ret = b.pop();%0A      while (!b.isEmpty()) a.push(b.pop());%0A      return ret;%0A    %7D%0A%0A    public void add(T val) %7B%0A      a.push(val);%0A    %7D%0A  %7D%0A%7D%0A

Problem 3_5