Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
JavaDoc says about PriorityQueue:
public class PriorityQueue<E>
An unbounded priority queue based on a priority heap. "The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction time, depending on which constructor is used". A priority queue does not permit null elements. A priority queue relying on natural ordering also does not permit insertion of non-comparable objects (doing so may result in ClassCastException). [/javadoc]
Is my constructor wrong or my assumption about Queue construction is wrong?
No, the way you're retrieving data from the queue is wrong. I already told you that you're accessing the elements from the queue using an enhanced for loop, and I asked you whether you know how the enhanced for loop works.