Handling exceptions, the functional way
summary
Shows a concrete pattern and a tiny library called maybe that wraps Java 8 operations that can throw checked exceptions into two APIs: a resolver that returns a value and a run-effect that returns none. Uses custom throwing supplier / throwing runnable functional interfaces, method references, and a resolveClosing resource helper to close Closable objects. Demonstrates parsing properties and reading files with separate, type-safe handlers per exception, returning explicit fallbacks, avoiding mutable state, and publishing the library to Maven (Java 8+).
AI-written summary · about
chapters (7)
- 0:00Introduction
- 1:26Functional programming basics
- 11:18Traditional exception handling
- 21:47Functional abstractions for exceptions
- 30:08Introducing Maybe library
- 41:24Practical Maybe examples
- 45:21Summary and closing
related talks
44mA Hitchhiker's Guide to the Functional Exception Handling in Java
48mA Hitchhiker's Guide to the Functional Exception Handling
55mPain-free Functional Programming with Java 21
46mDesigning Functional Programs
49mTen Common Mistakes Made in Functional Java 1
56mJava Sucks (So C# Didn't Have To)
41mArchitectures Using Functional Programming Concepts
52mFunctional Programming with Java 8
