摘要: 单例的五种实现 1. 立即加载:类加载 // 类加final防止子类覆盖方法 破坏单例性质 public final class Singleton1 implements Serializable { // 构造方法私有 但仍可以通过反射创建对象 private Singleton1() {} / 阅读全文
posted @ 2021-02-21 22:28 JefferyYang 阅读(59) 评论(0) 推荐(0)
摘要: 归并排序 public static void mergeSort(int[] a) { mergeSort(a, 0, a.length - 1); } public static void mergeSort(int[] a, int start, int end) { // 递归出口:数组长度 阅读全文
posted @ 2021-02-21 21:26 JefferyYang 阅读(58) 评论(0) 推荐(0)
摘要: Item1: consider static factory methods instead of constructors advantages: They have names They not required to create a new object each time they are 阅读全文
posted @ 2020-10-18 16:32 JefferyYang 阅读(52) 评论(0) 推荐(0)
摘要: Goal: quantify the relationship between problem size and running time(time complexity) The total running time of a program is determined by two primar 阅读全文
posted @ 2020-10-18 16:10 JefferyYang 阅读(58) 评论(0) 推荐(0)