When I run the below code, I get an exception and I don't know why.
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at simulateur.Simulateur.main(Simulateur.java:218)
Line 218 is for : for(Request r : Sys.queue) and Sys.queue is an ArrayList
//*************** DispatchRequest ***************
if(!Sys.queue.isEmpty())
{
algo = new SortingAlgo(Sys.queue, clock);
Sys.queue = algo.sorted_queue;
for(Request r : Sys.queue)
{
{
for(Porter p : p_i.porList)
{
if(p.p_state.equals("Available"))
{
...
...
Sys.queue.remove(r);
}
}
}
}
}