How to Eliminate Try-catch Blocks in Java Lambdas

And deploying the library to accomplish it to Maven Central.

Randal Kamradt Sr
Level Up Coding
Published in
5 min readFeb 26, 2021

--

Blocks
Photo by Ryan Quintal on Unsplash

This is a follow-up to my previous article Dealing with Exceptions in Functional Java and a bit of eating my own dog food from my article Sharing is Hard. At the end of Dealing with Exceptions in Functional Java, I indicated where there were still some lambda types missing and I wasn’t planning on trying to implement them. But fate had other plans for me.

After writing Sharing is Hard, I decided to tackle a new process, that of pushing something to Maven Central to be sharable by all. It turned out to be relatively easy, the hardest part was setting up my PGP keys so I could sign my jars which is a requirement for deploying to Maven Central. I won’t go over how to get the library deployed, you can find pretty good instructions here. But for the most part, it’s just making sure your pom.xml adheres to some basic standards and includes some plugins in the build section.

I had to change some aspects of the original code from Dealing with Exceptions in Functional Java, so rather than continue with the same repository, I created a new repository called Possibly, named after the main class in the library, the Possibly type which can be a value or an exception.

--

--