[Solved] Adding a non-comparable object to a PriorityQueue [closed]


I would not expect an exception to be thrown at all on that line. Read the docs more closely: an exception may be thrown

if the specified element cannot be compared with elements currently in this priority queue according to the priority queue’s ordering

Since there are no other elements currently in the priority queue, I would not necessarily expect an exception to be thrown.

solved Adding a non-comparable object to a PriorityQueue [closed]