forked from zfman/AlgorithmCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoker.java
More file actions
24 lines (20 loc) · 434 Bytes
/
Invoker.java
File metadata and controls
24 lines (20 loc) · 434 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package pattern.command;
import java.util.ArrayList;
import java.util.List;
/**
* 命令调用者
* @author 刘壮飞
* https://github.com/zfman.
* https://blog.csdn.net/lzhuangfei.
*/
public class Invoker {
public List<Order> orders=new ArrayList<>();
public void takeOrder(Order o){
orders.add(o);
}
public void placeOrders(){
for(Order o:orders){
o.execute();
}
}
}