I've found that the problem is solved by getting elements via the poll() method which is similar to dequeue.
PriorityQueue<Edge> edges = new PriorityQueue<Edge>();
edges.add(new Edge(1, 2, 23));
edges.add(new Edge(2, 3, 1000));
edges.add(new Edge(1, 3, 43));
Edge temp;
while ((temp = edges.poll()) != null)
System.out.println(temp);
The reason this works is because poll() returns the head of the PriorityQueue, which is the least element, while an iterator just returns the elements the way they were added to the queue.