PriorityQueue ์ •๋ ฌ ์™œ ์•ˆ๋ผ?

PriorityQueue ๋‚ด๋ฆผ์ฐจ์ˆœ ์ •๋ ฌํ•˜๋Š” ๋ฒ•

PriorityQueue<Integer> pq = new PriorityQueue<Integer>(Collections.reverseOrder());
PriorityQueue<Integer> pq = new PriorityQueue<Integer>((a, b) -> b - a);

๊ทผ๋ฐ ์ •๋ ฌ ์™œ ์•ˆ๋ผโ€ฆ?

์œ„์˜ ๋ฐฉ๋ฒ•์œผ๋กœ ์ •๋ ฌ์ด ๋˜๊ธดํ•˜์ง€๋งŒ ์ •๋ ฌ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์žฅํ•˜์ง€๋Š” ์•Š๋Š”๋‹ค. ์˜ค๋กœ์ง€ poll() ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•  ๋•Œ ์ตœ์†Ÿ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒƒ๋งŒ์„ ๋ณด์žฅํ• ๋ฟ!