Reputation: 366
I am working on realm database and want to convert RealmList to RealmResults. The realmlist is attribute of realm object.
Upvotes: 0
Views: 250
Reputation: 81539
It's very simple:
RealmResults<T> results = realmList.where().findAll();
Please note that this only works on managed RealmList.
Upvotes: 1
Reputation: 2096
Simple use query on your list :
class MyObject extends RealmObject {
RealmList<MySubObject> subObjects;
}
...
myObject.subObjects.where().findAll(); //returns a RealmResults
//you can query your list like
myObject.subObjects
.where()
.equalTo("status", "done")
.findAll(); //you can use sort, findFirst etc
Upvotes: 0