[JAVA] 자바 - Queue 큐 / PriorityQueue 우선순위 큐
mini_min
[JAVA] 자바 - Queue 큐 / PriorityQueue 우선순위 큐 ✔️ Queue : FIFO 구조 - 선입선출하는 구조다. - 중복이 저장 가능하다! - 큐는 LinkedList 로 객체를 생성한다. - 값을 받을 때, offer 를 사용한다. Queue q = new LinkedList(); q.offer("자바");//큐의 마지막에 요소 추가 q.offer("오라클"); q.offer("서블릿"); q.offer("스프링"); q.offer("자스"); // head 값 변환 후 삭제 while(q.peek() != null) {//peek() : head 반환. 없으면 null String s = q.poll();// poll() : head 반환 후 삭제. System.out.prin..