Complete the method below that reverses the order of elements in a Stack<Integer>
. Use a Queue to accomplish this.
Our Queue has the following interface.
Additionally, you are provided with an implementation of the MyQueue
named ArrayListQueue
. This queue does not
have a fixed capacity. You can create a new instance of the queue with
MyQueue<Integer> q = new ArrayListQueue<>();
.
Additionally, if the passed stack is null
, throw an IllegalArgumentException
.
Stuck? You may find these lessons helpful: