Java 8 Iterable.forEach() vs foreach loop

The better practice is to use for-each. Besides violating the Keep It Simple, Stupid principle, the new-fangled forEach() has at least the following deficiencies: Can’t use non-final variables. So, code like the following can’t be turned into a forEach lambda: Can’t handle checked exceptions. Lambdas aren’t actually forbidden from throwing checked exceptions, but common functional … Read more