title: Creating an Observable List/Collection
body: <p>I'm trying to create a <code>ChoiceBox</code> in JavaFX 8, which requires a <code>Collection</code>. I can't figure out how to create a <code>Collection</code> though... If I try:</p>
  
  <pre><code> ObservableList&lt;String&gt; list = new ObservableList&lt;String&gt;();
  </code></pre>
  
  <p>I get an error saying I can't instantiate <code>ObservableList</code> because it's abstract. Understandable. If I look at the doc for <code>ObservableList</code> I can see that <code>SortedList implements ObservableList</code>, but I can't do:</p>
  
  <pre><code> ObservableList&lt;String&gt; list = new SortedList&lt;String&gt;();
  </code></pre>
  
  <p>Because there's no applicable constructor. Apparently I need to have an <code>ObservableList</code> to pass to the <code>SortedList</code>, which is odd because I can't create an <code>ObservableList</code>.</p>
  
  <pre><code>constructor SortedList.SortedList(ObservableList&lt;? extends String&gt;,Comparator&lt;? super String&gt;) is not applicable
    (actual and formal argument lists differ in length)
  constructor SortedList.SortedList(ObservableList&lt;? extends String&gt;) is not applicable
    (actual and formal argument lists differ in length)
  </code></pre>
  
  <p>I'm not sure how to decipher that. If I try </p>
  
  <pre><code> ObservableList&lt;String&gt; list = new SortedList&lt;SortedList&lt;String&gt;&gt;();
   //or
   ObservableList&lt;String&gt; list = new SortedList&lt;ObservableList&lt;String&gt;&gt;();
  </code></pre>
  
  <p>out of desperation, I get an even more convoluted error.</p>
  
  <pre><code>    SortedList&lt;String&gt; list = new SortedList&lt;String&gt;();
  </code></pre>
  
  <p>doesn't work either. Somehow this works (but apparently uses an unsafe operation):</p>
  
  <pre><code>ChoiceBox box = new ChoiceBox(FXCollections.observableArrayList("Asparagus", "Beans", "Broccoli", "Cabbage" , "Carrot", "Celery", "Cucumber", "Leek", "Mushroom" , "Pepper", "Radish", "Shallot", "Spinach", "Swede" , "Turnip"));
  </code></pre>
  
  <p>So I tried:</p>
  
  <pre><code> ObservableList&lt;string&gt; list = new FXCollections.observableArrayList("Asparagus", "Beans", "Broccoli", "Cabbage" , "Carrot", "Celery", "Cucumber", "Leek", "Mushroom" , "Pepper", "Radish", "Shallot", "Spinach", "Swede" , "Turnip");
  </code></pre>
  
  <p>But no luck there either. I'm super confused, doing the same thigns over and over in an endless loop of trying to understand this. The documentation I've found shows examples that don't help, or no examples. The official documentation is useless too:</p>
  
  <blockquote>
    <p>Suppose, for example, that you have a Collection c, which may
    be a List, a Set, or another kind of Collection. This idiom creates a
    new ArrayList (an implementation of the List interface), initially
    containing all the elements in c.</p>
  
  <pre><code> List&lt;String&gt; list = new ArrayList&lt;String&gt;(c);
  </code></pre>
  </blockquote>
  
  <p>So to create <code>ArrayList</code>, an implementation of <code>List</code>, I need to have a <code>List</code>. the reason I went to the documentation in the first place was to learn how to make what they're assuming I have. I'm lost. Help?</p>