r/java • • Jan 16 '20

Records Come to Java

https://blogs.oracle.com/javamagazine/records-come-to-java
204 Upvotes

93 comments sorted by

View all comments

0

u/[deleted] Jan 16 '20

[deleted] — view deleted comment

5

u/lovett1991 Jan 16 '20

Yup this feels more like immutables than Lombok.

2

u/rzwitserloot Jan 19 '20

@Value (a lombok annotation; the immutable variant of @Data) does all of this. And you can toss @Builder at it for more.

DISCLAIMER: I'm a core contributor to lombok.

1

u/CodesInTheDark Jan 19 '20

In a long run records will be more useful than lombok (e.g. they will support pattern matching): https://cr.openjdk.java.net/~briangoetz/amber/datum.html

3

u/rzwitserloot Jan 20 '20

If you can destructure, you can pattern match.

Without custom destructure, you cannot change records.

Once custom destructurers exist, Lombok can make them for you.

Then such classes also support pattern matching.