title: Initialize 2d list in Java
body: <p>I am new to Java and trying to create a 2d list the size of which isn't fixed.I have a class which looks like this:</p>
  
  <pre><code>public class q1 {
      List&lt;List&lt;Integer&gt; &gt; L = new ArrayList&lt;List&lt;Integer&gt; &gt;(); 
  
      public void set(int m,int n){
          //This is the function which would get the size of the 2d list
      }
  }
  </code></pre>
  
  <p>I saw the answers but they had to be of fixed sizes, eg:</p>
  
  <pre><code>ArrayList&lt;String&gt;[][] list = new ArrayList[10][10];
  </code></pre>
  
  <p>But, I want different sizes of the list <strong>L</strong> for different objects. There were other options like <strong>copyOf</strong>, but can the above functionality be achieved just by this array?</p>