I have RealmResults<Section>one that has a field RealmList<Event>that I want to clear for each section.
I tried (insude mRealm.executeTransaction)
for (Section section : mSections) {
section.getEvents().clear();
}
and
Iterator<Section> sectionIterator = mSections.iterator();
while (sectionIterator.hasNext()) {
sectionIterator.next().getEvents().clear();
}
but realm throws this exception
java.util.ConcurrentModificationException: no external changes in the kingdom are allowed when RealmResults are repeated. using iterators.
source
share