List<E> to RealmList<E>
See original GitHub issueSorry if this is noob question, but I just ran into this issue…
Say I have a bunch of objects in ArrayList<MyObject> list
and I want to add it to my other realm object, how do I do that?
class OtherObject extends RealmObject {
private RealmList<MyObject> list;
// setter & getter
}
How to add that ArrayList
to OtherObject.setList(RealmList<MyObject> list)
?
I’ve tried RealmList<MyObject> realmList = (RealmList<MyObject>) realm.copyToRealm(list)
but got cast exception.
Thanks.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How convert from List to RealmList<RelmInt>? #5265 - GitHub
My model: public class Company extends RealmObject { @PrimaryKey private long id; private RealmList favorIds; private String address; ...
Read more >Rx Java parsing a List to RealmList - Stack Overflow
Rx Java parsing a List to RealmList ... Which is fine. however I want to get a RealmList. How can I achieve that?...
Read more >RealmList (Realm 10.10.1) - MongoDB
Returns true if the list contains the specified element when attached to a Realm. This method will query the native Realm underlying storage...
Read more >io.realm.RealmList Java Examples - ProgramCreek.com
This page shows Java code examples of io.realm.RealmList.
Read more >RealmList<RealmString> is an anti-pattern! - Medium
Solution: storing RealmList<primitive> as a String ... Yup, the problem is that people try to store the primitives as a List . It...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also this should work and save some memory:
Try this: