title: Creating a Two Dimensional ArrayList in Java
body: <p>I've been working on a school project that requires (or at least strongly suggests) using two dimensional ArrayLists in Java (specifically an ArrayList that holds ArrayList of <code>int</code>s). I don't find the syntax too hard to grasp, but the below code has really stumped me:</p>
  
  <pre><code>List&lt;ArrayList&lt;Integer&gt;&gt; arrList2D = new ArrayList&lt;&gt;();
  List&lt;Integer&gt; arrList1D = new ArrayList&lt;&gt;();
  arrList1D.add(1);
  arrList2D.add(arrList1D);
  </code></pre>
  
  <p>That snippet gives me the error: </p>
  
  <pre><code>Cannot convert List&lt;Integer&gt; to ArrayList&lt;Integer&gt; 
  </code></pre>
  
  <p>on the very last line. What I find confusing is that I explicitly instantiate <code>arrList1D</code> as an ArrayList. Is there something obvious I'm missing? Would definitely appreciate any help with this. Sorry for any redundant questions.</p>