Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.4.9, 1.5-M1
-
None
Description
http://www.zeroturnaround.com/blog/copy-on-iterate-java-idiom-considered-broken/ describes a problem in ArrayList constructor in JDK1.5 and less that they debugged in a Wicket application.
We can easy improve it by using the "simple solution":
for (Iterator i = Arrays.asList(collection.toArray()).iterator(); i.hasNext()