title: How do I swap two arraylist in JAVA?
body: <p>There are two ArrayList e.g.<code>list1 = {1,2,3}</code>  and <code>list2 = {7,6,4,2}</code> How to can swap these two list. So the result will be <code>list1 = {7,6,4,2}</code> and <code>list2 = {1,2,3}</code>
  Can I implement like this:</p>
  
  <pre><code>public void swapList(ArrayList&lt;Integer&gt; list1, ArrayList&lt;Integer&gt; list2){
      ArrayList&lt;Integer&gt; tmpList = list1;
      list1 = list2;
      list2 = tmpList;
  }
  </code></pre>