Category "concurrentmodificationexception"

How to avoid "ConcurrentModificationException" while add ArrayList elements?

I'm trying to add an item to the ArrayList in a certain order Iterator<Rating> it = arr.iterator(); while(it.hasNext()){ Rating o = it.next(); int

Avoid ConcurrentModificationException on java stream using cache

I'm getting occasionally ConcurrentModificationException with the following code: public Set<MyObject> getTypes(Set<Type> names) { Set<My