Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
final Car car = new Car();
final CarWashStep chain = new InitialWashStep();
chain.andThen(new SoapStep())
.andThen(new RinseStep())
.andThen(new PolishStep())
.andThen(new DryStep());
final Car finalCar = chain.applyTo(car);
System.out.println("Final car state is " + finalCar.washState());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment