One issue with collections is that when iterating a ConcurrentModificationException is thrown if a collection is changed (usually by a different thread). This is done to protect the Iterator from unpredictable behaviour. A common idiom to avoid it is to copy the collection before iteration like that:
for(Iterator i = new ArrayList(collection).iterator(); i.hasNext();) {...}
Note that the collection must either to be synchronized or otherwise suitable for a multi-threaded environment.
This idiom is a very common one, as easily proven by a simple Google Code search. In fact we used it several times in the JRebel code and it is present in several places in Wicket as well. So how could this cause an ArrayIndexOutOfBoundsException? Find out in our article:
http://www.zeroturnaround.com/blog/copy-on-iterate-java-idiom-considered-broken/