package esercizi; import exceptions.EmptyStackException; import queue.NodeQueue; import stack.Stack; /** * Created with MONSTER. * User: xgiovio * Date: 13/04/2014 * Time: 23:48 */ // emulate a stack with a queue public class QStack implements Stack { NodeQueue a = new NodeQueue(); @Override public void push(E element) { a.enqueue(element); } @Override public E top() throws EmptyStackException { if (a.isEmpty()){ throw new EmptyStackException(); }else { E t; for (int i = 0 ;i