Randgalt / record-builder

Record builder generator for Java records
Apache License 2.0
758 stars 55 forks source link

Add emptyDefaultForCollections options #58

Closed krzyk closed 3 years ago

krzyk commented 3 years ago

I think many people would like to have emptyDefaultForCollections, where instead of nulls builder would set following instances in the record built:

Randgalt commented 3 years ago

Duplicate of #56

krzyk commented 3 years ago

@Randgalt It doesn't look like a duplicate of #56.

My proposition is to handle null gracefully by using empty List/Set/Map, while #56 is all about umodifiable collections.

Randgalt commented 3 years ago

OK - I guess I misunderstood. You're staying if someone passes in a null to the builder then, e.g., List.of() is used instead of null? I'm not sure how I feel about that. I think that would be unexpected.

krzyk commented 3 years ago

@Randgalt thank you