title: How many new array objects are created by the ArrayList(Collection<? extends E> c)?
body: <p>I analyzed the following code and found that it should create 2 new array objects. Is this true?</p>
  
  <pre><code> ArrayList.java
               public ArrayList(Collection&lt;? extends E&gt; c) {
                      elementData = c.toArray();
                      size = elementData.length;
                      // c.toArray might (incorrectly) not return Object[] (see 6260652)
                      if (elementData.getClass() != Object[].class)
                          elementData = Arrays.copyOf(elementData, size, Object[].class);
                  }
  
              Analysis:
               elementData = c.toArray(); This creates a new array of object.
  
               elementData = Arrays.copyOf(elementData, size, Object[].class); This creates a new array of elementData.
  
         Arrays.java     
               public static &lt;T,U&gt; T[] copyOf(U[] original, int newLength, Class&lt;? extends T[]&gt; newType) {
                      T[] copy = ((Object)newType == (Object)Object[].class)
                          ? (T[]) new Object[newLength]
                          : (T[]) Array.newInstance(newType.getComponentType(), newLength);
                      System.arraycopy(original, 0, copy, 0,
                                       Math.min(original.length, newLength));
                      return copy;
                  }
  
          Array.newInstance(newType.getComponentType(), newLength);
  </code></pre>
  
  <p>Here new array object.</p>