If you have a few years of experience in the Java ecosystem, and you're interested in sharing that experience with the community (and getting paid for your work of course), have a look at the "Write for Us" page. Cheers. Eugen

If you’re working with Spring, check out "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.

>> Introduction to Vavr

Starting at the top – this is the high-level overview of the whole library and tools we can find there.

>> Guide to the Persistent Collections API

Vavr’s Collections API its one of its biggest advantages – collections are not only immutable but also persistent.

>> Guide to Try

Here, we dive deep into one of the Vavr’s monadic tools for exception handling – Try.

>> Guide to Either

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.

>> Introduction to Pattern Matching

Pattern Matching is a tool present in almost all functional programming languages. It’s a highly advanced form of a classical switch-case.

>> Introduction to Validation API

We can ease validating our objects by leveraging applicative functors and Validation API.

>> Handling Exceptions in Lambda Expressions

We can also use Vavr’s tools for dealing with an aching problem of checked exceptions in lambda expressions.

>> Property Testing

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.

>> Spring Data Support of Vavr’s Tools

Additionally, Vavr’s tools are now supported by Spring Data.

The new Certification Class of "REST With Spring" is finally out:


Leave a Reply

2 Comments on "Vavr Tutorial"

Notify of
Sort by:   newest | oldest | most voted
The only downside I see for now is, if we use Java collections classes in our code along with this library, which is quite expected, the code becomes more verbose with respect to type declarations. Or I could be missing something. For eg., io.vavr.collection.Map<String, io.vavr.collection.List> evenOddGroup = io.vavr.collection.List.of(1, 2, 3, 4, 5).groupBy(i -> i % 2 == 0 ? “Even” : “Odd”);
Grzegorz Piwowarek

Well, if you have colliding names, there is no other way to go, the good news is that Vavr is planning to change names of their collections in the future (add a short prefix to all of them), in order to avoid this kind of problems