本月博客排行
年度博客排行
-
第1名
宏天软件 -
第2名
龙儿筝 -
第3名
青否云后端云 - wallimn
- gashero
- vipbooks
- wy_19921005
- benladeng5225
- fantaxy025025
- zysnba
- ssydxa219
- e_e
- javashop
- sam123456gz
- arpenker
- tanling8334
- kaizi1992
- xpenxpen
- xiangjie88
- wiseboyloves
- ganxueyun
- xyuma
- sichunli_030
- lemonhandsome
- wangchen.ily
- jh108020
- zxq_2017
- jbosscn
- Xeden
- zhanjia
- forestqqqq
- luxurioust
- lzyfn123
- johnsmith9th
- ajinn
- nychen2000
- wjianwei666
- daizj
- hanbaohong
- 喧嚣求静
- ranbuijj
- silverend
- kingwell.leng
- lchb139128
- kristy_yy
- lich0079
- jveqi
- java-007
- sunj
- yeluowuhen
最新文章列表
Item 5: Avoid creating unnecessary objects
1. An object can always be reused if it is immutable
2. The statement:
String s = new String("stringette");
creates a new String instance each time it is executed, and none of ...
Item 4: Enforce noninstantiability with a private constructor
1. Classes that are just a grouping of static methods and static fields can be used to group related methods on primitive values or arrays, in the manner of java.lang.Math or java.util.Arrays. The ...
Item 3: Enforce the singleton property with a private constructor or an enum
1. Making a class a singleton can make it difficult to test its clients, as it’s impossible to substitute a mock implementation for a singleton unless it implements an interface that serves as its ...
Item 2: Consider a builder when faced with many constructor parameters
1. Static factories and constructors share a limitation: they do not scale well to large numbers of optional parameters.
2. Telescoping constructor pattern provides a constructor with only ...
Effective Java General Programming
Chapt8 General Programming
45.最小化局部变量的作用域
>第一次使用前声明
>几乎所有的局部变量都应该在声明时包含一个初始值
例外:在try块外声明,在块内和块外使用
>使用for循环优于while循环
>保持方法短小、专一
46.for-each循环优于传统的for循环
>例外情况 ...
#EffectiveJava笔记#阅读心得
Effective Java 这本书的价值有多高想必搞Java的人都应该了解。我把它当做一本工具书,在工作之余拿出来读,收获很大。你会发现这本书几乎涵盖了 Java 语言规范的所有知识点,很多语言相关的问题你都可以在这里找到一段解释。印象最深的是,上周末在读某源码时被它里面到处使用的 static member class 吸引住了,然后纠结为什么要用 static,在网上各种搜罗资料,最后在 St ...