Hi, For each iteration the current thread (main) read an element from the Queue and then alter it with the poll method. So at the second iteration, the content of collection (pq) has changed and it's the cause of the throw of ConcurrentModificationException. Read the Javadoc of it.
If you write something like :
it works fine.
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!