title: How to create a new RealmObject that contains a RealmList
body: <p>I need to convert one of my model objects (which was automatically filled from Json using Retrofit) to a Realm Object. </p>
  
  <p>At first, my code was <code>new RealmPoll()</code> instead of <code>realm.createObject(RealmPoll.class)</code>. (I was getting <code>NullPointerException</code> just like <a href="https://stackoverflow.com/questions/31455819/realm-null-pointer-when-writing-to-database">this question</a>) So I solved that issue. But I cannot find a way to copy a RealmList. </p>
  
  <p>I can't find any examples of creating RealmObjects with RealmLists in the <a href="https://realm.io/docs/java/latest/#creating-objects" rel="nofollow noreferrer">official Realm website tutorial</a>  and the <a href="https://realm.io/docs/java/0.79.0/api/io/realm/RealmList.html" rel="nofollow noreferrer">docs</a> say</p>
  
  <blockquote>
    <p>Only Realm can create managed RealmLists. Managed RealmLists will
    automatically update the content whenever the underlying Realm is
    updated, and can only be accessed using the getter of a RealmObject.</p>
  </blockquote>
  
  <p>which makes me believe it is somehow not possible? But it is a really simple task. I don't know how to interpret the docs meaning. </p>
  
  <p>Is there any way possible to just convert an object (such as RetrofitPoll below) to a realm object (such as RealmPoll below) if it contains a list?</p>
  
  <p><strong>One function that illustrates my question:</strong></p>
  
  <pre><code>private RealmPoll convertRetrofitPollToRealmPoll(Realm realm, RetrofitPoll retrofitPoll)
  {
      RealmPoll realmPoll = realm.createObject(RealmPoll.class);  //&lt;----- fixed, used to be "new RealmPoll()".
  
      //Convert List&lt;Answer&gt;
      RealmList&lt;RealmAnswer&gt; realmAnswers = new RealmList&lt;RealmAnswer&gt;();  //&lt;----- How to do same thing here?
      for(RetrofitAnswer retrofitAnswer : retrofitPoll.getAnswers())
      {
           realmAnswers.add(convertRetrofitAnswerToRealmAnswer(retrofitAnswer));
      }
      realmPoll.setAnswers(realmAnswers);
  }
  </code></pre>
  
  <p><strong>RetrofitPoll.java</strong></p>
  
  <pre><code>public class RetrofitPoll
  {
      private List&lt;Answer&gt; answers;
      private String id;
      private Date startDate;
      private String title;
      private Topic topic;
  }
  </code></pre>
  
  <p><strong>RealmPoll.java</strong></p>
  
  <pre><code>public class Poll extends RealmObject
  {
      private RealmList&lt;Answer&gt; answers;
      private String id;
      private Date startDate;
      private String title;
      private Topic topic;
  }
  </code></pre>