这篇文章意在列出笔者关于《Effective Java》第二版的读书笔记。点击每个Item,就能link到具体的笔记。
Chapter 2: Creating and Destroying Objects
- Item 1: Consider static factory methods instead of constructors 优先考虑静态工厂方法而非构造器
- Item 2: Consider a builder when faced with many constructor parameters 遇到多个构造器参数时要考虑用构造器
- Item 3: Enforce the singleton property with a private constructor or an enum type 用私有构造器或者枚举类型强化singleton属性
Chapter 4: Classes and Interfaces 类和接口
- Item 19: Use interfaces only to define types 接口只用于定义类型
- Item 20: Prefer class hierarchies to tagged classes 类层次优于标签类
- Item 21: Use function objects to represent strategies 用函数对象表示策略
- Item 22: Favor static member classes over nonstatic 优先考虑静态成员类
Chapter 5: Generics 泛型
- Item 23:
- Item 24:
- Item 25:
- Item 26: Favor generic types 优先考虑泛型
- Item 27: Favor generic method 优先考虑泛型方法
Chapter 6: Enums and Annotations 枚举和注释
网友评论