I just announced the new Spring Boot 2 material, coming in REST With Spring:
Vavr is a functional library for Java 8+ that provides immutable data types and functional control structures.
Note that functional programming is not only a new set of tools to get accustomed with but also a new paradigm to understand.
So let’s jump into it.
Starting at the top – this is the high-level overview of the whole library and tools we can find there.
Vavr’s Collections API its one of its biggest advantages – collections are not only immutable but also persistent.
Here, we dive deep into one of the Vavr’s monadic tools for exception handling – Try.
Either is a tool that enables us to represent values that can be one of two different types. Either can be used for exception handling or simply for business logic that diverges in certain scenarios.
Pattern Matching is a tool present in almost all functional programming languages. It’s a highly advanced form of a classical switch-case.
We can ease validating our objects by leveraging applicative functors and Validation API.
We can also use Vavr’s tools for dealing with an aching problem of checked exceptions in lambda expressions.
Property Testing is an approach that allows us to specify the high-level behavior of a program and not bother with creating individual test cases manually.
Additionally, Vavr’s tools are now supported by Spring Data.