-5

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, /, *, +]

I wish to do this mainly so i can use RPN to calculate the result of the calculation, and i need to be able to index elements in the array/

Is there a way to do this?

Thanks in advance for any help :)

user3120023
  • 197
  • 3
  • 6
  • 16

1 Answers1

0

List list1 = (List) outputQueue;

blackgreen
  • 34,072
  • 23
  • 111
  • 129
Batman
  • 1
  • 4
  • Thanks for the quick reply :) When i do this, i fi try to index the newly created list like list1[2] i get an error saying "The type of the expression must be an array type but it resolved to List" Could you advise on this – user3120023 Dec 20 '13 at 20:45