Java, adding modified string to ArrayList with foreach loop
<p>I'm iterating through an ArrayList, modifying the string, and trying to add it to a new list.  It doesn't change the original list.  Within a foreach loop in Java, is it creating a copy of the object so I can add it?</p>

<pre><code>List&lt;String&gt; newString = new ArrayList&lt;String&gt;(); 
for (String s : lineOfWords {  // lineOfWords is a String that has text in it
   s = s.replaceAll("\\b(\\w+)\\b(\\s+\\1)+\\b", "$1"); 
   newString.add(s); 
}  
</code></pre>

<p>Thanks in advance!</p>

<p>EDIT: I don't mean for it to change the original string, but to add the new string, in this case s, to my newString ArrayList.</p>
