1

When executing findAll() or findAllAsync() query in Realm, without explicit sorting, such as:

RealmResults<MyRealmObject> results = realm.where(MyRealmObject.class).findAll();

what is the order of elements accessible through the RealmResults object?

  • Is it ordered by @PrimaryKey if there is one? If so, is it ascending or descending?
  • Is it the order in which the objects were inserted in the first place?
  • Is it random?
  • Is it nondeterministic?

Also, is this realm-core or platform specific, for example does the behavior differ between realm-java and realm-cocoa?

maciekjanusz
  • 4,702
  • 25
  • 36
  • 1
    It's not deterministic because if you delete something then the order can change. Until you delete something, it's order of insertion; then who knows! The core is the same, the bindings are different; and `realm-cocoa` has integrated more of `realm-object-store` than `realm-java` did. – EpicPandaForce Feb 23 '17 at 15:30

0 Answers0