Java Priority Queue

  • + 1 comment

    List stdLst = new ArrayList<>(); students.forEach(student -> stdLst.add(student));

    • seem like u are misunderstanding with prioirtyqueue. Prioirtyqueue doesn't care about the order in the whole queue but the smallest element in front of the queue. So if you do this, elements in the queue(except the first element) can't be in the require order