title: Dynamic ArrayList in Java
body: <p>I have one doubt in java, can we create dynamic <code>ArrayList</code> or <code>String[]</code> inside a for-loop. For example in my app there are  categories field is there (not static, obtaining from server), I want to create <code>ArrayList</code> or <code>String[]</code> object based on size of categories. How can I create a dynamic <code>ArrayList</code> in side a loop?</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>for(int i =0; i&lt;20; i++)
  {
      ArrayList &lt;String&gt; list(i) = new ArrayList&lt;String&gt;();
  }
  </code></pre>
  
  <p>can we  create an object like this? 
  based on category position, I can call the list items like list(positon), can we do like this java? </p>