JAVA
[Java] 우선순위 큐 함수
밍맹030
2021. 7. 28. 23:31
728x90
PriorityQueue<Integer> heap = new PriorityQueue<>();
heap.offer(value) : queue에 value 추가
heap.peek() : queue의 첫 번째 요소 반환
heap.poll() : queue의 첫 번째 요소를 삭제하고 반환. queue가 비어있는 경우 null 반환
heap.remove() : 큐의 첫 번째 값 제거
heap.clear() : 큐 초기화
728x90