Skip to content

Instantly share code, notes, and snippets.

View java-interview's full-sized avatar

java-interview

View GitHub Profile
// Flyweight object interface
public interface CoffeeOrder {
public void serveCoffee(CoffeeOrderContext context);
}
// ConcreteFlyweight object that creates ConcreteFlyweight
public class CoffeeFlavor implements CoffeeOrder {
private String flavor;
public CoffeeFlavor(String newFlavor) {
this.flavor = newFlavor;
}