, Ranch Hand
Should not the following code give ConcurrentModificationException as we are
using the for-each loop and doing poll() on the PriorityQueue
The output is =============== 2.
Could not understand why this is happening ??
I don't see anything in the API documentation for the iterator() method of PriorityQueue which suggests it might do that.
Agreed. Modifying a collection while iterating is not a good idea because you can get a concurrent modification exception. It doesn't mean that you always will.
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
Why should you try IntelliJ IDEA ?
This thread has been viewed 716 times.
All times above are in ranch (not your local) time.
The current ranch time is
Jul 16, 2018 16:18:53.