title: why is my original list array is getting modified
body: <p>why when I call </p>
  
  <pre><code>ArrayList&lt;String&gt; reversedList = ListUtils.reverse(list);
  </code></pre>
  
  <p>is modifying the original list, even though I'm making a copy of it inside the method</p>
  
  <pre><code>package com.javablackbelt.utils;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.List;
  
  public class ListUtils {
  
      public static void main(String arg[]) {
          String[] arr = {"one", "two", "three", "four", "five"};
          ArrayUtils.print(arr);
  
          System.out.println();
  
          String [] reversedArr = ArrayUtils.reverse(arr);
          ArrayUtils.print(reversedArr);
  
          System.out.println();
  
          ArrayList&lt;String&gt; list = ArrayUtils.toArrayList(arr);
          ListUtils.print(list);  
  
          ArrayList&lt;String&gt; reversedList = ListUtils.reverse(list);
          ListUtils.print(reversedList);
  
          String[] arrFromList = ListUtils.toArray(list);
          ArrayUtils.print(arrFromList);
  
      }
  
      public static void print(ArrayList&lt;String&gt; aStr) {
          System.out.print("list: [ ");
          for(String l: aStr)
              System.out.print(l+" ");
          System.out.println(" ] size: "+aStr.size());
      }
  
      public static ArrayList&lt;String&gt; reverse(ArrayList&lt;String&gt; aList) {
          ArrayList&lt;String&gt; newList = aList;
  
          Collections.reverse(newList);
          return newList;
      }
  
      public static String[] toArray(ArrayList&lt;String&gt; list) {
          ArrayList&lt;String&gt; newList = list;
          String[] newStr = newList.toArray(new String[list.size()]);
  
          return newStr;
      }
  
  }
  </code></pre>