title: Is there any way to reuse an arraylist in java?
body: <p>I have two ArrayLists . I want just reuse the second arraylist (temporaryArrayList). Please notice my code . Hope you of course will understand what i want to make you know.</p>
  
  <pre><code>    ArrayList&lt;ArrayList&lt;String&gt;&gt; arrayListContainer = new ArrayList&lt;&gt;();
      ArrayList&lt;String&gt; temporaryArrayList = new ArrayList&lt;&gt;();
  
      temporaryArrayList.add("I");
      temporaryArrayList.add("you");
      temporaryArrayList.add("he");
      temporaryArrayList.add("she");
      temporaryArrayList.add("we");
  
      arrayListContainer.add(temporaryArrayList);
  
      temporaryArrayList.clear();
  
      temporaryArrayList.add("Rahim");
      temporaryArrayList.add("jon");
      temporaryArrayList.add("don");
      temporaryArrayList.add("shaila");
  
      arrayListContainer.add(temporaryArrayList);
      temporaryArrayList.clear();
  
  
      System.out.println(arrayListContainer.size());
  </code></pre>
  
  <p>The code is giving expected size of arrayListContainer but does not give expected result for</p>
  
  <pre><code>System.out.println(arrayListContainer.get(0).get(0));
  </code></pre>
  
  <p>How can I achieve this. Any kind of reply or suggestion will be accepted thankfully.</p>