上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
摘要: /** * 插入排序 * @param arr */ public static void InsertSort(int[] arr) { int temp; // 以下不是插入 类似冒泡 /*for (int i = 0; i < arr.length - 1; i++) { for (int j 阅读全文
posted @ 2020-12-21 16:44 不要西红柿 阅读(61) 评论(0) 推荐(0)
摘要: public static void bubbleSort(int[] arr){ int temp; for (int i = 0; i < arr.length - 1; i++) { for (int j = 0; j < arr.length - 1 - i; j++) { if (arr[ 阅读全文
posted @ 2020-12-21 16:09 不要西红柿 阅读(75) 评论(0) 推荐(0)
摘要: 装饰者模式就是疯狂套娃。 先埋坑,以后更深入的了解在来填坑。 2022:装饰者模式,符合开闭原则。 java.io 包中关于字节流的操作。 InputStream is = new FileInputStream("aa.txt"); // BufferedInputStream 其实也是一种装饰类 阅读全文
posted @ 2020-12-19 21:49 不要西红柿 阅读(82) 评论(0) 推荐(0)
摘要: 策略模式的使用参考 java 提供的 Compartor 接口在 list.sort(new Compartor(){}); 中的实现。 每一个实现 Compartor接口重写了 compare 接口的类都是一种排序策略。 实现 Comparable 接口重写 compareTo(Object o) 阅读全文
posted @ 2020-12-19 13:32 不要西红柿 阅读(80) 评论(0) 推荐(0)
摘要: 建造者模式对客户端屏蔽了复杂对象的创建过程,而且复杂对象的创建步骤交给一个指挥者(Director)进行封装,提供出一个简单明了的方法供上层模块使用。 eg: 以客户需要建一所新的房子为背景: 定义客户为客户端(上层使用模块 Client) 包工头为指挥者(Director) 施工队资质为抽象建造者 阅读全文
posted @ 2020-12-19 10:06 不要西红柿 阅读(85) 评论(0) 推荐(0)
摘要: 记录对工厂方法的理解: 工厂方法的作用在于封装产品的实现细节及设置。比如手机工厂,如果可以设置手机的操作系统应该在工厂方法中提前设定然后通过工厂方法获取 PhoneFactory.getPhone();, 而不是通过客户端 new Phone(); phone.setOS("xxx"); 用户端只想 阅读全文
posted @ 2020-12-17 11:59 不要西红柿 阅读(100) 评论(0) 推荐(0)
摘要: 单例模式分饿汉式(程序启动,没有使用到该类就加载到JVM)和饱汉式(第一次被使用的时候才加载到JVM称懒加载)。 单例设计模式首先都是将构造方法私有,确保不会被直接 new 生成实例。确保线程安全的方式,饿汉式通过jvm加载机制确保。饱汉式确保程序安全的方式常有 双重检查机制 和 静态内部类机制。 阅读全文
posted @ 2020-12-15 07:22 不要西红柿 阅读(79) 评论(0) 推荐(0)
摘要: 1 import org.springframework.beans.BeansException; 2 import org.springframework.context.ApplicationContext; 3 import org.springframework.context.Appli 阅读全文
posted @ 2020-06-30 14:01 不要西红柿 阅读(563) 评论(0) 推荐(0)
摘要: ftpClient.listFiles() 可以返回当前ftp服务器路径下的所有文件。 ftpClient.changeWorkingDirectory("pathName") 只能单级进入, pathName不能传全路径,也不能传多级目录。 ftpClient.changeToParentDire 阅读全文
posted @ 2020-05-14 21:42 不要西红柿 阅读(1125) 评论(0) 推荐(0)
摘要: springmvc基于 apache 的 commons-fileupload.jar 实现文件上传。 springmvc 封装了一个 MultipartResolver 组件,负责将客户端上传的文件流转换成 MultipartFile 封装类。 可以通过 MultipartFile 封装类获取文件 阅读全文
posted @ 2020-03-27 00:43 不要西红柿 阅读(235) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页