title: ArrayList matrix
body: <p>I have an <code>ArrayList</code> of <code>ArrayList</code>-s.
  How can I initialize the field with given number of rows and number of columns?
  I tried this:</p>
  
  <pre><code>ArrayList&lt;ArrayList&lt;E&gt;&gt; field;
  
  public Field(int rows, int cols) {
      field = new ArrayList&lt;ArrayList&lt;E&gt;&gt;(rows);
      for(ArrayList&lt;E&gt; t : field)
          t = new ArrayList&lt;E&gt;(cols);
  }
  </code></pre>
  
  <p>but it doesn't work. How can I do it?</p>