re: Builder Design Pattern VIEW POST

FULL DISCUSSION
 

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.

code of conduct - report abuse