[Java] ConcurrentModificationException - 탐색 중인 리스트 변경
[Java] ConcurrentModificationException - 탐색 중인 리스트 변경 발생 오류 ConcurrentModificationException 예외 발생 문제 원인 자바에서 탐색 중인 리스트가 변경될 경우 발생하는 오류이다. 탐색 중인 리스트에 요소를 추가하여 발생한 오류이다. iterator에 remove를 사용하여 탐색 중인 리스트 내의 요소를 삭제할 수 있다. 하지만 일반적인 iterator는 추가를 지원하지 않는다. while (!pQ.isEmpty()) { ... //탐색 중인 리스트 for (Iterator iterator = edges[now].iterator(); iterator.hasNext();) { int[] list = iterator.next(); int ke..
공부/프로그래밍 오류
2022. 8. 11. 19:37