I am having this problem that I had used Arraylist in my entire program up till now and now I need its functioning to be that of priority queue too.
So I did the obvious that seemed to me and casted it like PriorityQueue z = (PriorityQueue) x
where x was arraylist.
At runtime this gave an error that this is not possible.
Is there any simple way to make this work. I can’t change entire array list as a priority queue since then I’ll have to update all the functions used…..
Should I add item each time from arraylist to a new priority queue or is there a better method…
Thanks a lot…
1 Answer