PriorityQueue
2019-10-04 本文已影响0人
Leahlijuan
PriorityQueue<Integer> pq = new PriorityQueue<>();
pq.add(1);
pq.add(2);
pq.remove(1);
pq.contains(1);
pq.clear();
pq.peek();
pq.poll();
pq.offer(1);
pq.size();
pq.toArray();
Queue<Integer> maxHeap = new PriorityQueue<>((a1, a2) -> (a2 - a1));