Take a look at the javadoc for ConncurrentModificationException. When you're iterating a collection, you cannot add/remove from that collection.
On 3/20/06, Nima Boustanian <[EMAIL PROTECTED]> wrote: > > Hey all > > I keep getting this java.util.ConcurrentModificationException when I try > to add rows to a table. The below code won't > work, but if I remove the For loop and just add "result.add(new > ConversationsPlaceHolderTable("test")); it will output > "test" as the first row in my table. I Googled a bit and found a post by > Kent Tong saying that this probably is because I am > trying to modify a collection while an iterator is trying to iterate > over it, but I can't figure out how this should be resolved in my > IBasicTableModel > class. Any ideas? > > public Iterator getCurrentPageRows(int firstRow, int rowsPerPage, > ITableColumn sortColumn, boolean sortOrder) { > > List result = new ArrayList(); > > for (Iterator it = postList.iterator(); it.hasNext(); ) { > Post post = (Post)it.next(); > postList.add(post); > result.add(new ConversationsPlaceHolderTable(post.getTitle > ())); > } > > return result.iterator(); > } > > Thanks! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >