摘要: 最简单的单例「饿汉式」public class Singleton{private static Singleton instance=new Singleton(); //other fields private Singleton(){} public static Singleton getInstance(){ return instance; }... 阅读全文
posted @ 2015-07-17 15:18 行者吴江 阅读(239) 评论(0) 推荐(0) 编辑
摘要: BufferedReader in = new BufferedReader(new FileReader("in.txt"));PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("out.txt")));String s;while((s=in.readLine())!=null){ out.printl... 阅读全文
posted @ 2015-07-17 14:21 行者吴江 阅读(372) 评论(0) 推荐(0) 编辑
摘要: // 取得核心数量final int numberOfCores = Runtime.getRuntime().availableProcessors();// 阻塞系数(计算型为0,IO 型为0~1)final double blockingCoefficient = 0;// 计算线程池大小final int poolSize = (int) (numberOfCores / (1 - blo... 阅读全文
posted @ 2015-07-17 14:19 行者吴江 阅读(1268) 评论(0) 推荐(0) 编辑
摘要: 最近需要 Review 代码,学习了《代码整洁之道》、《代码质量》等书籍。把对这些代码之道的学习心得整理成文 阅读全文
posted @ 2015-07-17 14:15 行者吴江 阅读(230) 评论(0) 推荐(0) 编辑