Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
oldchain
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
You can’t perform that action at this time.