title: Save a list of objects to ORMLite database
body: <p>I am looking for a way to save a list of objects to the database with ORMLite and read upon this question: <a href="https://stackoverflow.com/questions/13570578">Best way to store several ArrayLists in ORMLite for ApplicationSettings</a></p>
  
  <p>And the accepted answer makes sense to me: </p>
  
  <pre><code>public class YourClass {
      @GeneratedId
      private int id;
  
      @ForeignCollectionField
      private Collection&lt;MyString&gt; bunchOfStrings = new ArrayList&lt;MyString&gt;();
  }
  
  public class MyString{
       @DatabaseField(canBeNull = true, foreign = true)
       private YourClass yourClass;
  
       @DatabaseField
       private String text;
  }
  </code></pre>
  
  <p>And the only thing that I don't understand is this line <code>private Collection&lt;MyString&gt; bunchOfStrings = new ArrayList&lt;MyString&gt;()</code>. Why do we save the <code>ForeignCollectionField</code> as <code>Collection&lt;MyString&gt;</code> instead of as <code>ArrayList&lt;MyString&gt;</code>? When working with the <code>bunchOfStrings</code> object above, do we always need to cast it to <code>ArrayList&lt;MyString&gt;</code>? </p>