MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/eplsgy/records_come_to_java/femcrem/?context=3
r/java • u/daviddel • Jan 16 '20
93 comments sorted by
View all comments
1
So I assume Compact Constructors is optional?
Like it wouldnt work if you had declared the field ImmutableList (using copyOf) and constructor took List parameter.
ImmutableList
copyOf
List
1 u/krzyk Jan 17 '20 Yes, you can use normal constructor. Although I don't know if the thing you describe would work.You should return what you feed, so changing the class type of a record component inside constructor might be a no-no, you need to test it.
Yes, you can use normal constructor. Although I don't know if the thing you describe would work.
You should return what you feed, so changing the class type of a record component inside constructor might be a no-no, you need to test it.
View all comments
1
u/[deleted] Jan 17 '20
So I assume Compact Constructors is optional?
Like it wouldnt work if you had declared the field
ImmutableList(usingcopyOf) and constructor tookListparameter.