@Slf4jpublicclassPriorityQueueUsage { @TestpublicvoidusePriorityQueue(){PriorityQueue<Integer> integerQueue =newPriorityQueue<>();integerQueue.add(1);integerQueue.add(3);integerQueue.add(2);int first =integerQueue.poll();int second =integerQueue.poll();int third =integerQueue.poll();log.info("{},{},{}",first,second,third); } @TestpublicvoidusePriorityQueueWithComparator(){PriorityQueue<Integer> integerQueue =newPriorityQueue<>((a,b)-> b-a);integerQueue.add(1);integerQueue.add(3);integerQueue.add(2);int first =integerQueue.poll();int second =integerQueue.poll();int third =integerQueue.poll();log.info("{},{},{}",first,second,third); }}