ArrayList cast to PriorityQueue + java
<p>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.</p>

<p>So I did the obvious that seemed to me and casted it like <code>PriorityQueue z  = (PriorityQueue) x</code>
where x was arraylist.</p>

<p>At runtime this gave an error that this is not possible.</p>

<p>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.....</p>

<p>Should I add item each time from arraylist to a new priority queue or is there a better method...</p>

<p>Thanks a lot...</p>
