title: Converting 2D ArrayList to 2D Array
body: <p>I've looked at several answers already, and I am getting errors with the answers that I've found. I'm trying to convert an ArrayList of Doubles[] to a normal double 2D array. My code:</p>
  
  <pre><code>    public ArrayList&lt;Double[]&gt;  ec;
      public double[][]           ei;
      ...
      encogCorpus = new ArrayList&lt;Double[]&gt;();
      ...
      ec.add(inputs);
      ...
      ei = new double[ec.size()][];
  
      for (int i = 0; i &lt; ec.size(); i++) {
          ArrayList&lt;Double&gt; row = ec.get(i);
          ei[i] = row.toArray(new double[row.size()]);
      }
  </code></pre>
  
  <p>I'm getting errors that say</p>
  
  <blockquote>
    <p>Type mismatch: cannot convert from Double[] to ArrayList</p>
  </blockquote>
  
  <p>And </p>
  
  <blockquote>
    <p>The method toArray(T[]) in the type ArrayList is not applicable for the arguments (double[])</p>
  </blockquote>