Community
Participate
Working Groups
When removing items using SlotIterator#remove it does not comply with the java.util.Iterator requirements. Using a test report design with two or more data sources... This code fails to remove the first element from the collection: Iterator iter = design.getDataSources().iterator(); while (iter.hasNext()) { Object dataSource = iter.next(); // do something with dataSource... iter.remove(); } This code does work, but should throw a IllegalStateException: Iterator iter= design.getDataSources().iterator(); while (iter.hasNext()) { iter.remove(); } As per the java.util.Iterator#remove javadoc: "Throws: IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method." There's an easy workaround, just not using the iterator: SlotHandle dataSources = design.getDataSources(); while (dataSources.getCount() > 0) { Object dataSource = dataSources.get(0); // do something with dataSource... dataSources.dropAndClear(0); }