exceptions error handling lambdas

Feedback on checked exceptions and lambdas

I got a lot of interesting feedback on Checked exceptions and lambdas. Let’s start with my own: after writing the post, I realized I had written a similar post some time ago. Mistakes I made I made a mistake in the code regarding Apache Commons Lang 3, where I mistakenly used the recover() function, which is actually from Vavr. Apache Commons Lang provides a regular utility function, which mimics the custom code we wrote last week. Vavr offers the Try class, which encapsulates methods

exceptions error handling lambdas

Checked exceptions and lambdas

Java’s checked exceptions were a massive improvement over C’s error-handling mechanism. As time passed and experience accumulated, we collectively concluded that we weren’t there yet. However, Java’s focus on stability has kept checked exceptions in its existing API. Java 8 brought lambdas after the 'checked exceptions are great' trend. None of the functional interface methods accepts a checked exception. In this post, I will demonstrate three different approaches to mak

exceptions lambdas streams apache commons vavr functional programming

Exceptions in lambdas

Java introduced the concept of checked exceptions. The idea of forcing developers to manage exceptions was revolutionary compared to the earlier approaches. Nowadays, Java remains the only widespread language to offer checked exceptions. For example, every exception in Kotlin is unchecked. Even in Java, new features are at odds with checked exceptions: the signature of Java’s built-in functional interfaces doesn’t use exceptions. It leads to cumbersome code when one integrates leg