RealmResult iterators now detect changes to underlying tableview.

RealmResults now correctly identify any changes to the underlying query tableview and throws a ConcurrentModificationException if detected.

@kneth @bmunkholm @emanuelez 
It might be that we don't expose it. But the dynamic API can set fields in
objects. But yeah, here we set the the whole object to something else which
at his point is not even something we support on the Realm. So ok, let it
be.

On Tue, Nov 25, 2014 at 3:36 PM, Christian Melchior <
notifications@github.com> wrote:

> In realm/src/main/java/io/realm/RealmResults.java:
>
> > +        }
> > +
> > +        @Override
> > +        public int previousIndex() {
> > +            assertRealmIsStable();
> > +            return pos - 1;
> > +        }
> > +
> > +        @Override
> > +        public void remove() {
> > +            throw new RealmException("Removing RealmObjects while iterating is not supported. ");
> > +        }
> > +
> > +        @Override
> > +        public void set(E object) {
> > +            throw new RealmException("Replacing elements not supported.");
>
> We can? RealmResults doesn't have a set method currently. Perhaps you are
> thinking about RealmLink?
>
> Also it doesn't really makes sense to set an object on a search result.
> The semantics would be a little confusing, right?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/realm/realm-java/pull/603/files#r20865843>.
>