title: java.util.ConcurrentModificationException while Inserting the values in arrayList
body: <pre><code>javax.faces.FacesException: #{scheduleBean.insert()}: java.util.ConcurrentModificationException
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
      at javax.faces.component.UICommand.broadcast(UICommand.java:315)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  Caused by: javax.faces.el.EvaluationException: java.util.ConcurrentModificationException
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code> public void insert(){
  
         for(ScheduleMaster v:arrayList1){
  
             arrayList1.add(mm.i, v); 
         }           
         List&lt;ScheduleMaster&gt;temp1=new ArrayList&lt;ScheduleMaster&gt;();
         temp1=arrayList1;
         System.out.println("Coming Insert");
         Iterator&lt;ScheduleMaster&gt;itr=temp1.iterator();
           while(itr.hasNext()){
               ScheduleMaster s=itr.next();
               s.setServiceCode(serviceCode);
               s.setServiceName(serviceName);
               s.setVessalCode(vessalCode);
               s.setVessalName(vessalName);
               s.setVoyage(voyage);
               s.setPortCode(portCode);
               s.setPortName(portName);
               s.setTerminalCode(terminalCode);
               s.setTerminalName(terminalName);
               s.setEta(eta);
               s.setEtaTimes(etaTimes);
               s.setEtd(etd);
               s.setEtdTimes(etdTimes);
               s.setBound(bound);
               s.setAta(ata);
               s.setAtaTimes(ataTimes);
               s.setAtd(atd);
               s.setAtdTimes(atdTimes);
               arrayList1.add(s);                        
  
         } 
  
     }    
  </code></pre>