I prefer Java 8 style builders
Burger.of(14, ingredients -> ingredients .pepperoni() .lettuce() .tomato());
You can easily create an overload which accepts only the mandatory arguments
Burger.of(14);
The configuration is implemented as a Consumer of type T, where T is a some sort of configuration object.
See Molten JSON for a JSON Builder implemented that way.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I prefer Java 8 style builders
You can easily create an overload which accepts only the mandatory arguments
The configuration is implemented as a Consumer of type T, where T is a some sort of configuration object.
See Molten JSON for a JSON Builder implemented that way.