So I'm writing a function to perform the shunting yard algorithm on some numbers/operators. The issue is that I have a loop at the end that adds all the remaining operators to the output queue, but for some reason they are not being added. I have tested it and the program enters the loop, and the stack has numbers in it before it goes into the loop but they never get added to the queue, the stack is also empty after going through the loop, so it seems that the operators are being popped from the stack but not added to the queue. Here is the relevant bit of code:
while(operatorStack.empty() != true)
{
System.out.println("Hello");
outputQueue.add(operatorStack.pop());
}
EDIT:
My implementations of stack and queue are:
Queue<Object> outputQueue = new LinkedList<Object>();
Stack<Character> operatorStack = new Stack<Character>();