Feedback on checked exceptions and lambdas
Source: Dev.to

I got a lot of interesting feedback on the article Checked exceptions and lambdas.
Let’s start with my own: after writing that post I realized I had already written a similar post some time ago.
Mistakes I made
I mixed up Apache Commons Lang 3 with Vavr.
I used the recover() function, which belongs to Vavr, while Apache Commons Lang only provides regular utility methods.
Vavr’s Try class encapsulates methods that throw checked exceptions and bridges Java to a more functional style.
var foo = new Foo();
CheckedFunction1 throwingFunction = foo::throwing;
var result = List.of("One", "Two")
.stream()
.map(input ->
Try.of(() -> throwingFunction.apply(input))
.recover(IOException.class, e -> "")
.getOrElse("")
)
.toList();
Vavr’s API is quite large, but Try itself has a fairly understandable surface:
Things I forgot
On Mastodon, Oliver Drotbohm pointed out that the Spring Framework provides its own wrapping utilities.
Oliver Drotbohm: “@frankel@mastodon.top If you happen to build a Spring‑based application, there are a few helpers, too: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/util/function/package-summary.html”

Things I learned
Another piece of feedback mentioned Result4J, a library I hadn’t heard of before.
Result4J provides a Rust‑like Result type that can represent either a successful value or an error. While Java’s native way of reporting errors is via exceptions, a Result type can be handy in functional‑style code where pure functions are expected to throw no exceptions.
- Repository:
- Maven artifact:
io.github.sviperll:result4j
Example (from the README)
Catcher.ForFunctions io = Catcher.of(IOException.class).forFunctions();
String concatenation = Stream.of("a.txt", "b.txt", "c.txt")
.map(io.catching(name -> loadResource(name)))
.collect(ResultCollectors.toSingleResult(Collectors.join()))
.orOnErrorThrow(Function.identity());

Additional feedback
On Bluesky, Donald Raab (former designer of Eclipse Collections) shared a post about how Eclipse Collections handles checked exceptions.
“Thanks for sharing! I wrote the following blog about Exception Handling in Eclipse Collections a few years ago. There’s also a link to a great blog from @brianvermeer.nl in there. 🙏”
You can read the post here:
— Donald Raab (@thedonraab.bsky.social) 2026‑01‑18 19:30 UTC
Conclusion
Feedback is always great. Thanks to feedback, I realized I made a mistake, received pointers to the same features in Spring, and discovered result4j. Having coded for years in Kotlin and more recently in Rust made me appreciate the Result approach. I’ll evaluate the usage of result4j as an alternative to Vavr in future projects.
To go further
Originally published at A Java Geek on February 1st, 2026.
