...it is not generally permissible for one thread to modify a Collection while another thread is iterating over it. In general, the results of the iteration are undefined under these circumstances. Some Iterator implementations (including those of all the general purpose collection implementations provided by the JRE) may choose to throw this exception if this behavior is detected. Iterators that do this are known as fail-fast iterators, as they fail quickly and cleanly, rather that risking arbitrary, non-deterministic behavior at an undetermined time in the future.
Originally posted by Manoj Raghuwanshi:
Thanks for help.
What I'm thinking is - while iterating over the list, inspect the objects and copy those objects in to another list. Then remove this list from the original by using List.removeAll(Collection c).
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
| Consider Paul's rocket mass heater. |