Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created July 5, 2020 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theboreddev/c42aee0608c066ea4648c4fab12a7534 to your computer and use it in GitHub Desktop.
Save theboreddev/c42aee0608c066ea4648c4fab12a7534 to your computer and use it in GitHub Desktop.
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