I have a for-loop to iterate over my population. For a condition, I want to remove that object from my population. When I run my model, a ConcurrentModificationException occurs. The reason should be, that I cannot modify my population, while iterating over the collection in a for-loop.
Is there any simple way to fix that problem? I tried using an iterator, but because my code is in an event, which occurs every minute new, it did not really work.
for (testpop t : testpops) {
    if (dateToTime(t.arrival) <= time()) {
        System.out.println(t.arrival);
        remove_testpops(t);
    }
}
 
    