I am trying to Reverse a Java stack, I realise that there isn't a .reverse() method for that class. And as far as I now, the only way to do it would be to go through each element one by one, and place it into another one.
The problem with that is, the .pop() method keeps removing Objects from the original stack, and I want to keep them there ! I'm at a loss.
I would greatly appreciate any help. Here's what I had before, but like I said it destroys the original stack.
Note: getOptimumPath() returns as Stack.Code:
Stack<Node<Adjustment>> op = new Stack<Node<Adjustment>>();
int stackSize = opm.getOptimumPath().size();
for(int i = 0; i < stackSize; i++)