title: Add ArrayList to another ArrayList in java
body: <p>I am having the following java code, in which I am trying to copy the ArrayList to another ArrayList.</p>
  <pre class="lang-java prettyprint-override"><code>ArrayList&lt;String&gt; nodes = new ArrayList&lt;String&gt;();
  ArrayList NodeList = new ArrayList();
  ArrayList list = new ArrayList();
  
  for (int i = 0; i &lt; PropertyNode.getLength() - 1; i++) {
      Node childNode = PropertyNode.item(i);
      NodeList Children = childNode.getChildNodes();
  
      if (Children != null) {
          nodes.clear();
          nodes.add(&quot;PropertyStart&quot;);
          nodes.add(Children.item(3).getTextContent());
          nodes.add(Children.item(7).getTextContent());
          nodes.add(Children.item(9).getTextContent());
          nodes.add(Children.item(11).getTextContent());
          nodes.add(Children.item(13).getTextContent());
          nodes.add(&quot;PropertyEnd&quot;);
      }
      NodeList.addAll(nodes);
      list.add(NodeList);
  }
  </code></pre>
  <p>I want the &quot;list&quot; array to be in this format:</p>
  <pre><code>[[PropertyStart,a,b,c,PropertyEnd],[PropertyStart,d,e,f,PropertyEnd],[PropertyStart,......]]
  </code></pre>
  <p>But from the above code, the &quot;list&quot; array output is seen like this:</p>
  <pre><code>[PropertyStart,a,b,c,PropertyEnd,PropertyStart,d,e,f,PropertyEnd,PropertyStart,....PropertyEnd]
  </code></pre>
  <p>I think you might have noticed the difference. I am not able to achieve the result in expected format.</p>