摘要:
阅读全文
摘要:
介绍 角色 使用场景 代码实现 public interface Command { //这个方法是一个返回结果为空的方法 //实际项目中,可以根据需求设计多个不同的方法 void execute(); } class ConcreteCommand implements Command{ priv 阅读全文
摘要:
代码实现 public interface Mediator { void register(String dname,Department d); void command(String dname); } /* * 同事类接口 */ public interface Department { v 阅读全文
摘要:
代码实现 public interface MyIterator { void first(); //将游标指向第一个元素 void next(); //将游标指向下一个元素 boolean hasNext(); //判断是否存在下一个元素 boolean isFirst(); boolean is 阅读全文
摘要:
后面我们将学习设计模式里面的行为型模式 代码实现 /** * 抽象类 * @author bzhx * 2017年3月14日 */ public abstract class Leader { protected String name; protected Leader nextLeader; / 阅读全文