Skip to content

Instantly share code, notes, and snippets.

@mstepien
Last active March 3, 2017 21:53
Show Gist options
  • Save mstepien/109e569381293628ec861d0c34aaf8d0 to your computer and use it in GitHub Desktop.
Save mstepien/109e569381293628ec861d0c34aaf8d0 to your computer and use it in GitHub Desktop.
Decorator Pattern done with function composition
Coffee coffee = Barista.makeCoffee(
new Arabica(),
Coffee::withMilk,
Coffee::withSprinkles);
System.out.println(
coffee.getIngredients()
+ ". Cost: "+
coffee.getCost());
//https://github.com/mstepien/functional-java-patterns/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment