Practical experience of using Java Records

45 min

Abstract

Java Records is one of the most prominent language feature introduced of the recent time. It is not only an elegant way to declare an immutable value object type but also a tool to improve overall code quality. Using records reduces the amount of boilerplate code, eliminates the need for third-party code generators such as Lombok, and enables new language features and programming techniques.

In this talk I want to share my experience of migration our codebase to use records by looking at simple code examples.

What is the key difference between a record and a class? What are the ways to validate record instances? How to apply a builder design pattern? Why records are useful when writing functional code? How records will work with pattern matching?

Talk structure

Links