从队列转换为 ArrayList [英] Convert from Queue to ArrayList
本文介绍了从队列转换为 ArrayList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将包含数字和运算符的队列更改为 ArrayList.我正在用 Java 编码.
I want to change a queue containing numbers and operators into an ArrayList. I am coding in Java.
目前我的队列定义如下:
Currently my Queue is defined as follows:
Queue outputQueue = new LinkedList();
队列当前包含以下数据:
The queue currently contains the following data:
[1, 9, 3, /, 4, 3, -, 2, /, *, +]
我想这样做主要是为了我可以使用RPN来计算计算结果.
I wish to do this mainly so i can use RPN to calculate the result of the calculation.
有没有办法做到这一点?
Is there a way to do this?
在此先感谢您的帮助:)
Thanks in advance for any help :)
推荐答案
ArrayList list = new ArrayList(outputQueue);
这篇关于从队列转换为 ArrayList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文