|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 4 of 9
E:\classes\com\javaworld\jpitfalls\article5>java com.javaworld.jpitfalls.article5.BadVisitor2
one
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:445)
at java.util.AbstractList$Itr.next(AbstractList.java:418)
at com.javaworld.jpitfalls.article5.BadVisitor2.main(BadVisitor2.java:15)
As the output shows, while we iterate, the class implementing the Iterator interface specifically checks for modification outside the iteration implementation class and throws an Exception. It would be nice if the Enumeration implementation class were upgraded with this same behavior.