1

Got a List<String> iterated as follow:

void validateValue() throws ValidationException { 
    aList.forEach(k -> validateValue(k));
}

void validateValue (String s) throws ValidationException {
    ..
}

But the compiler says: Unhandled exception type ValidationException

Seems the exception has to be handled in the forEach clause.

Is that normal or is there a turn around (beside Java 7 style iteration below that pass)?

void validateValue() throws ValidationException {
    for(String k : aList) {
        validateValue(k);
    }
}
Hey StackExchange
  • 2,057
  • 3
  • 19
  • 35

0 Answers0