Download via Jitpack
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.Jadefalke256</groupId>
<artifactId>Try-Catch-Wrapper</artifactId>
<version>v1.0.1</version>
</dependency>
Try.attempt(this::executeMethod)
.onCatch(Throwable::printStacktrace)
.run();
var files = Try.attempt(() -> Files.list(path))
.onCatch(IOException.class, Throwable::printStacktrace)
.obtain();
files.ifPresent(this::doSomething);
Try.attempt(this::startProcess)
.onFinally(this::endProcess);
.run();