toArray(new MyObject[size]) vs iterating over list and filling the array
<p>which one of the following methodologies is safe from performance hits, assume that the size of List is large (may be 1,000 objects).</p>

<p><strong>i)</strong></p>

<pre><code>List&lt;String&gt; myList = new ArrayList&lt;String&gt;();

for(int i=0; i &lt;=10; i++){
    myList.add(""+i);
}

String[] array = myList.toArray(new String[myList.size()]);

myArrayMethod(array); // this method returns the array - it modifies the content but not size of array.

myListMethod(myList); // this method processes the list.
</code></pre>

<p><strong>ii)</strong></p>

<pre><code>List&lt;String&gt; myList = new ArrayList&lt;String&gt;();

for(int i=0; i &lt;=10; i++){
    myList.add(""+i);
}

String[] array = new String[myList.size()];
int i = 0;
for(String str : myList){
   array[i] = myList.get(i);
   i++;
}
myArrayMethod(array); // this method returns the array - it modifies the content but not size of array.

myListMethod(myList); // this method processes the list.
</code></pre>
