Example
public static class
ClassA
implements
Iterator {
//Outros métodos Iterator...
public
Object next () {
try
{
//...
}
catch
( Exception e ) {
// Manipular exceções aqui
}
}
}
Solução
Reconsidere a funcionalidade da cláusula catch. Certifique-se de que java.util.NoSuchElementException é emitido no erro
public static class
ClassA
implements
Iterator {
//Outros métodos Iterator...
public
Object next() {
try
{
//...
}
catch
( Exception e ) {
throw new NoSuchElementException();
}
}
return nextObj;
}