new Recipe(
mix().milk(milk).eggs(eggs).flour(flour)
);
new Recipe(
mix().eggs(eggs).flour(flour).milk(milk)
);
new Recipe(
mix().eggs(eggs).milk(milk)
);
public static class Present {} public static class Missing {} public Recipe(Builder<Present, Present, Present> builder) { this.milk = builder.milk; this.eggs = builder.eggs; this.flour = builder.flour; }
static Builder<Missing, Missing, Missing> mix() { return new Builder<Missing, Missing, Missing>(); } public Builder<Present, EggState, FlourState> milk(Milk milk) { return new Builder<Present, EggState, FlourState>( milk, this.eggs, this.flour ); }
Use a spacebar or arrow keys to navigate