Functional Programming With Java: Method References

Besides lambdas expressions, Java 8 introduced another language syntax change in the form of a new operator, :: (double colon), to create so-called method references. Even though I talked about and used method references in earlier articles, it’s time to take a closer look.

Functional Programming With Java: map, filter, reduce

The three methods, map, filter, and reduce, are the cornerstone of any functional programming. Usually, our data pipelines consist of one or more intermediate operations, transforming (aka mapping) and/or filtering elements, and a terminal operation to gather the data again (aka reducing).

Functional Programming With Java: Exception Handling

In my previous articles about functional programming, I’ve shown how to incorporate a more functional style into our Java code. But I’ve omitted a crucial topic: how to deal with exceptions.

Functional Programming With Java: Immutability

As laid out in the first piece, immutability is one of the core concepts of functional programming. Real functional programming languages support it by design, at a language-level. But in Java and most non-functional languages, we need to design and implement it ourselves, at code-level.

Functional Programming With Java: Streams

Java 8 gave us the Stream API, a lazy-sequential data pipeline of functional blocks. It isn’t implemented as a data structure or by changing its elements directly. It’s just a dumb pipe providing the scaffolding to operate on, making it really a smart pipe.