摘要:
最简单的单例「饿汉式」public class Singleton{private static Singleton instance=new Singleton(); //other fields private Singleton(){} public static Singleton getInstance(){ return instance; }... 阅读全文
摘要:
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... 阅读全文
摘要:
// 取得核心数量final int numberOfCores = Runtime.getRuntime().availableProcessors();// 阻塞系数(计算型为0,IO 型为0~1)final double blockingCoefficient = 0;// 计算线程池大小final int poolSize = (int) (numberOfCores / (1 - blo... 阅读全文
摘要:
最近需要 Review 代码,学习了《代码整洁之道》、《代码质量》等书籍。把对这些代码之道的学习心得整理成文 阅读全文