📄 testcommand.java
字号:
package org.gof.action.command;
import java.util.List;
import java.util.Iterator;
/**
* <p>Title: command命令模式</p>
* <p>Description:command模式范例</p>
* <p>Copyright: Copyright (c) 2007</p>
* 将来自客户端的请求传入一个对象,无需了解这个请求激活的 动作或有关接受这个请求的处理细节
* @author by lbj
* @version 1.0
*/
public class TestCommand {
public static void main(String[] args) {
List queue = Producer.produceRequests();
for (Iterator it = queue.iterator(); it.hasNext(); ) {
//客户端直接调用execute方法,无需知道被调用者的其它更多类的方法名。
( (Command) it.next()).execute();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -