I want to maintain two queues, Queue A is for pop , Queue B is for backup, so if i pop all objects out from A, how do I restore Queue A from B?
while (still has input)
A.push(input)
B.push(input)
while A is not empty
A.pop()
Then how do I restore A from B??? In the meantime, I still want to keep B as my backup.
I know some very stupid way to do it , like assign one more queue C and then pop all Bout. And then restore B from queue C
One way is to use the
copymodule.