This means that the list of objects is being changed during the iteration. This can happen if
- other thread modify this collection while you are iterating
- you do it yourself by calling
o.getGetListObjects().remove(lo)
oro.getGetListObjects().add(otherObject)
into your loop.
Second problem is easy to fix. Just do not modify collection during iteration or use Iterator.remove()
for this purpose.
Second problem is harder. You should care not to use the same collection in different threads or use collection safe for such operation, e.g. ConcurrentSkipListSet
.
You are welcome to provide more details about your application to get better recommendations.