public int pop() {
if(empty()) {
return -1;//两个队列都为空,意味着当前的栈为空
}
if(!qu1.isEmpty()) {
int size = qu1.size();
for (int i = 0; i < size-1; i++) {
//for (int i = 0; i < qu1.size()-1; i++) {
int val = qu1.poll();
qu2.offer(val);
}
return qu1.poll();
}else {
int size = qu2.size();
for (int i = 0; i < size-1; i++) {
int val = qu2.poll();
qu1.offer(val);
}
return qu2.poll();
}
}