摘要: 代码示例 package 设计模式.代理模式.静态代理; public class Demo { public static void main(String[] args) { DogProxy dogProxy = new DogProxy(new Dog()); dogProxy.voice( 阅读全文
posted @ 2021-04-21 21:51 一柒微笑 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 策略模式:定义一系列的算法,把每一个算法封装起来, 并且使它们可相互替换。 /** * 排序类 * @param <T> */ public class Sort<T> { /** * 排序算法 * @param arr 需要排序的数组 * @param comparator 比较器 */ publ 阅读全文
posted @ 2021-04-21 13:51 一柒微笑 阅读(44) 评论(0) 推荐(0) 编辑