import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
{
Pizza myPizza = new PizzaBuilder()
.setDough(Dough.WHITE)
.setCheese(Cheese.WHITE)
.addTopping(Topping.Kittens)
.addTopping(Topping.Salami)
.buildPizza();
}
static enum Dough{
WHITE, BROWN
}
static enum Cheese{
WHITE, BROWN
}
static enum Topping{
Kittens, Onions, Salami
}
static class Pizza{
private Dough dough;
private Cheese cheese;
private HashSet<Topping> toppings;
private Pizza(Dough dough, Cheese cheese, HashSet<Topping> toppings){
this.dough = dough;
this.cheese = cheese;
this.toppings = toppings;
}
//add some getters
}
static class PizzaBuilder{
private Dough dough;
private Cheese cheese;
private HashSet<Topping> toppings = new HashSet<Topping>();
public PizzaBuilder(){
}
public PizzaBuilder setDough(Dough dough){
this.dough = dough;
return this;
}
public PizzaBuilder setCheese(Cheese cheese){
this.cheese = cheese;
return this;
}
public PizzaBuilder addTopping(Topping topping){
this.toppings.add(topping);
return this;
}
public Pizza buildPizza(){
return new Pizza(this.dough, this.cheese, this.toppings);
}
}
}
CmltcG9ydCBqYXZhLnV0aWwuKjsKaW1wb3J0IGphdmEubGFuZy4qOwppbXBvcnQgamF2YS5pby4qOwoKY2xhc3MgTWFpbgp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlQaXp6YSBteVBpenphID0gbmV3IFBpenphQnVpbGRlcigpCgkJCS5zZXREb3VnaChEb3VnaC5XSElURSkKCQkJLnNldENoZWVzZShDaGVlc2UuV0hJVEUpCgkJCS5hZGRUb3BwaW5nKFRvcHBpbmcuS2l0dGVucykKCQkJLmFkZFRvcHBpbmcoVG9wcGluZy5TYWxhbWkpCgkJCS5idWlsZFBpenphKCk7Cgl9CgkKCXN0YXRpYyBlbnVtIERvdWdoewoJCVdISVRFLCBCUk9XTgoJfQoJc3RhdGljIGVudW0gQ2hlZXNlewoJCVdISVRFLCBCUk9XTgoJf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