← Back to context

Comment by samus

3 days ago

When you use lambdas you lose control over when and how often your code gets executed. Since checked exceptions are very often thrown by code that has side effects, I'd consider the friction to be a feature.

> collecting all the thrown exceptions in a separate loop

It's really not comfortable to do so in Java since there is no standard `Either` type, but this is also doable with a custom collector.

> Since checked exceptions are very often thrown by code that has side effects, I'd consider the friction to be a feature.

This is true, but I think that it’s partly true because checked exceptions are cumbersome here. In my ideal world, the majority of functions would throw exceptions, testing cases that today are either missed or thrown as unchecked exceptions.