This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Client | |
public class CommandPatternDemo { | |
public static void main(String[] args) { | |
//Stock | |
Stock abcStock = new Stock(); | |
Broker broker = new Broker(); | |
broker.takeOrder(() -> abcStock.buy()); | |
broker.takeOrder(() -> abcStock.sell()); | |
//Bond | |
Bond bond = new Bond(); | |
broker.takeOrder(() -> bond.buyBonds()); | |
broker.takeOrder(() -> bond.sellBonds()); | |
broker.placeOrders(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment