How can I fix this error java.util.ConcurrentModificationException
I get an error on the following line. I'm doing the process of adding to the jsonarray. Please help me. jsonArr=new JSONArray(); if(req.getSession().getAttribute("userses")!=null){ String name=(req.getParameter("name")==null?"":to_EnglishName(req.getParameter("name").toUpperCase())); if(!name.equals("")){ for(Book c:GlobalObjects.bookList){ if(c.getBookName().startsWith(name)){ jsonObjec=new JSONObject(); jsonObjec.put("label",c.getBookName()); jsonObjec.put("value", c.getId()); jsonArr.add(jsonObjec);//java.util.ConcurrentModificationException } } } } jsonArr.write(res.getWriter()); This is