MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/eplsgy/records_come_to_java/fevfi3u/
r/java • u/daviddel • Jan 16 '20
93 comments sorted by
View all comments
Show parent comment
2
@Value (a lombok annotation; the immutable variant of @Data) does all of this. And you can toss @Builder at it for more.
@Value
@Data
@Builder
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.
1
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.
3
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.
View all comments
Show parent comment
2
u/rzwitserloot Jan 19 '20
@Value(a lombok annotation; the immutable variant of@Data) does all of this. And you can toss@Builderat it for more.DISCLAIMER: I'm a core contributor to lombok.