Exemple

public static class ClassA implements Iterator {
//Other Iterator methods...
public Object next () {

try {
//...
} catch ( Exception e ) {
// Handle exceptions here
}
}

}


Solution
Reconsidérez l'utilisation de la clause catch. Assurez-vous que java.util.NoSuchElementException est émis sur erreur


public static class ClassA implements Iterator {
//Other Iterator methods...
public Object next() {

try {
//...
} catch ( Exception e ) {
throw new NoSuchElementException();
}
}
return nextObj;
}