Talk:Builder pattern: Difference between revisions

Content deleted Content added
Line 110:
 
public class BuilderExample {
public static void main(String[] args) {
Cook cook = new Cook();
PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();
cook.setPizzaBuilder(hawaiianPizzaBuilder);
cook.constructPizza();
Pizza spicyhawaiian = cook.getPizza();
cook.setPizzaBuilder(hawaiianPizzaBuilder);
cook.constructPizza();
cook.setPizzaBuilder(spicyPizzaBuilder);
Pizza hawaiian = cook.getPizzaconstructPizza();
Pizza spicy = cook.getPizza();
cook.setPizzaBuilder(spicyPizzaBuilder);
}
cook.constructPizza();
Pizza spicy = cook.getPizza();
}
}
 
Line 130:
 
public class BuilderExample {
public static void main(String[] args) {
Cook cook = new Cook();
PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();
cook.constructPizza(hawaiianPizzaBuilder);
Pizza hawaiian = hawaiianPizzaBuilder.getPizza();
cook.constructPizza(spicyPizzaBuilder);
Pizza spicy = spicyPizzaBuilder.getPizza();
}
}