参考:https://www.cnblogs.com/wei-jing/p/10806236.html
Comparator<Integer> cm = new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2 - o1;
}
};
Queue<Integer> queue = new PriorityQueue<>(cm);
queue.offer(1);
queue.offer(3);
queue.offer(2);
queue.offer(6);
queue.offer(-4);
System.out.println(queue.poll());
System.out.println(queue.poll());
System.out.println(queue.poll());
System.out.println(queue.poll());
System.out.println(queue.poll());