我在 Servlet 类中有以下代码,我得到了
ConcurrentModificationException checkforcomodification at java.util.Abstractlist
在 for (Projects persist: projectList) {
我该如何解决这个问题以及导致此异常的原因
代码片段
List<Projects> projectList = new ArrayList<Projects>();
Projects project = new Projects();
projectList.add(project);
for (Projects persist: projectList) { // error in this line
persist.setPNo(pNo);
persist.setExpirtyDate(eDate;
myDAO.persistProjects(projectList);
projectList.clear();
}