Stephan van Hulst wrote:You can also use the iterator, but then you'll have to call i.remove() after each call to i.next().
Thanks Steve...that post regarding min heap was quite informative...by the way the following code worked fine:
while(!prq.isEmpty())
{
System.out.println(prq.poll());
}
The point here is iterator scrambles the order in which the elements are stored in the priority queue. so either we can use peek or poll.
Thanks for your kind replies.
Regards
Luke.