Search code examples
androidrealm

RealmChangeListener Or OrderedRealmCollectionChangeListener?


What is the difference between the RealmChangeListener and the OrderedRealmCollectionChangeListener?


Solution

  • RealmChangeListener<T> receives only the element the change occurred on, like Realm, RealmResults or RealmObject

    But OrderedRealmCollectionChangeListener<T> can only be added to RealmResults/RealmList, however it also provides you with OrderedRealmCollectionChangeSet which contains the exact position of where an item was inserted, modified or deleted.

    There is also RealmObjectChangeListener that you can add to RealmObject which receives the fields that have been modified.