Realm v3.0.0 Release Notes

Release Date: 2017-02-28 // about 7 years ago
  • ๐Ÿ’ฅ Breaking Changes

    • RealmResults.distinct() returns a new RealmResults object instead of filtering on the original object (#2947).
    • โšก๏ธ RealmResults is auto-updated continuously. Any transaction on the current thread which may have an impact on the order or elements of the RealmResults will change the RealmResults immediately instead of change it in the next event loop. The standard RealmResults.iterator() will continue to work as normal, which means that you can still delete or modify elements without impacting the iterator. The same is not true for simple for-loops. In some cases a simple for-loop will not work (https://realm.io/docs/java/3.0.0/api/io/realm/OrderedRealmCollection.html#loops), and you must use the new createSnapshot() method.
    • RealmChangeListener on RealmObject will now also be triggered when the object is deleted. Use RealmObject.isValid() to check this state(#3138).
    • RealmObject.asObservable() will now emit the object when it is deleted. Use RealmObject.isValid() to check this state (#3138).
    • โœ‚ Removed deprecated classes Logger and AndroidLogger (#4050).

    ๐Ÿ—„ Deprecated

    • ๐Ÿšš RealmResults.removeChangeListeners(). Use RealmResults.removeAllChangeListeners() instead.
    • ๐Ÿšš RealmObject.removeChangeListeners(). Use RealmObject.removeAllChangeListeners() instead.
    • RealmResults.distinct() and RealmResults.distinctAsync(). Use RealmQuery.distinct() and RealmQuery.distinctAsync() instead.

    โœจ Enhancements

    • โž• Added support for sorting by link's field (#672).
    • โž• Added OrderedRealmCollectionSnapshot class and OrderedRealmCollection.createSnapshot() method. OrderedRealmCollectionSnapshot is useful when changing RealmResults or RealmList in simple loops.
    • โž• Added OrderedRealmCollectionChangeListener interface for supporting fine-grained collection notifications.
    • โž• Added support for ChangeListeners on RealmList.
    • โž• Added RealmList.asObservable().

    ๐Ÿ› Bug Fixes

    • Element type checking in DynamicRealmObject#setList() (#4252).
    • Now throws IllegalStateException instead of process crash when any of thread confined methods in RealmQuery is called from wrong thread (#4228).
    • Now throws IllegalStateException when any of thread confined methods in DynamicRealmObject is called from wrong thread (#4258).

    Internal

    • ๐Ÿ‘‰ Use Object Store's Results as the backend for RealmResults (#3372).
      • Use Object Store's notification mechanism to trigger listeners.
      • Local commits triggers Realm global listener and RealmObject listener on current thread immediately instead of in the next event loop.