Ciao a tutti, se utilizzo la seguente classe:

codice:
public class Result extends ArrayList {
	private Iterator i;
	
	public Result() {
		super();
		i = this.iterator();
	}


 void addArrayResult(Value v[]) {
		for(int i = 0; i < v.length; i++)
		this.add((Value)v[i]);
	}
 

 void addArrayResult(String v[]) {
	for(int i = 0; i < v.length; i++)
	this.add((String)v[i]);
}
	
	
 void addResult(String r) {
		this.add((String)r);
	}
 

 void addResult(Value r) {
	this.add((Value)r);
}
	
	
	public boolean hasNext() {
		return i.hasNext();
	}
	
	public String next() {
		try {
		return i.next().toString();
		} catch(NoSuchElementException ex) {
			return null;
		}
	}
}
Aggiungendo e iterando allo stesso tempo mi viene lanciata questa eccezione: ConcurrentModificationException

La classe la uso così:

codice:
public class TestLoad {
	public static void main(String[] args) {
		try {
		Result r = null;
            Result cR = null;
		Connection c = Connection.connectTo("Test");
		r = c.execQuery("getAllTabs");
String str;
		while(r.hasNext()) {
                  str = r.next();
			System.out.println("Tabella " + str);
			cR = c.execQuery("selectTab " + str + "\n" +
                  "getAllFields");
while(cR.hasNext()) {
				System.out.println(cR.next() + "\t");
		}
			}
		c.close();
		} catch(DBException e) {
			e.printStackTrace();
		}
	}
}
Qualcuno saprebbe dirmi come permettere un comportamento simile senza che venga lanciata questa eccezione?

grazie