Effective Java(第3版)各章节的中英文对照
- Chapter 2. Creating and Destroying Objects(创建和销毁对象)
- Chapter 2 Introduction(章节介绍)
- 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(使用私有构造函数或枚举类型执行单例属性)
- Item 4: Enforce noninstantiability with a private constructor(用私有构造函数执行非实例化)
- Item 5: Prefer dependency injection to hardwiring resources(依赖注入优于硬连接资源)
- Item 6: Avoid creating unnecessary objects(避免创建不必要的对象)
- Item 7: Eliminate obsolete object references(排除过时的对象引用)
- Item 8: Avoid finalizers and cleaners(避免使用终结器和清除器)
- Item 9: Prefer try with resources to try finally(使用try-with-resources优于try-finally)
- Chapter 3. Methods Common to All Objects(对象的通用方法)
- Chapter 3 Introduction(章节介绍)
- Item 10: Obey the general contract when overriding equals(重写equals方法时应遵守的约定)
- Item 11: Always override hashCode when you override equals(当重写equals时,也重写hashCode)
- Item 12: Always override toString(总是重写toString方法)
- Item 13: Override clone judiciously(明智地重写clone方法)
- Item 14: Consider implementing Comparable
- Chapter 4. Classes and Interfaces(类和接口)
- Chapter 4 Introduction(章节介绍)
- Item 15: Minimize the accessibility of classes and members(尽量减少类和成员的可访问性)
- Item 16: In public classes use accessor methods not public fields(在公共类中,使用访问器方法,而不是公共字段)
- Item 17: Minimize mutability(减少可变性)
- Item 18: Favor composition over inheritance(优先选择复合而不是继承)
- Item 19: Design and document for inheritance or else prohibit it(继承要设计良好并且具有文档,否则禁止使用)
- Item 20: Prefer interfaces to abstract classes(接口优于抽象类)
- Item 21: Design interfaces for posterity(为后代设计接口)
- Item 22: Use interfaces only to define types(接口只用于定义类型)
- Item 23: Prefer class hierarchies to tagged classes(类层次结构优于带标签的类)
- Item 24: Favor static member classes over nonstatic(支持使用静态成员类而不是非静态类)
- Item 25: Limit source files to a single top level class(源文件仅限有单个顶层类)
- Chapter 5. Generics(泛型)
- Chapter 5 Introduction(章节介绍)
- Item 26: Do not use raw types(不要使用原始类型)
- Item 27: Eliminate unchecked warnings(消除unchecked警告)
- Item 28: Prefer lists to arrays(列表优于数组)
- Item 29: Favor generic types(优先使用泛型)
- Item 30: Favor generic methods
- Item 31: Use bounded wildcards to increase API flexibility
- Item 32: Combine generics and varargs judiciously
- Item 33: Consider typesafe heterogeneous containers
- Chapter 6. Enums and Annotations(枚举和注释)
- Chapter 6 Introduction(章节介绍)
- Item 34: Use enums instead of int constants
- Item 35: Use instance fields instead of ordinals
- Item 36: Use EnumSet instead of bit fields
- Item 37: Use EnumMap instead of ordinal indexing
- Item 38: Emulate extensible enums with interfaces
- Item 39: Prefer annotations to naming patterns
- Item 40: Consistently use the Override annotation
- Item 41: Use marker interfaces to define types
- Chapter 7. Lambdas and Streams(λ表达式和流)
- Chapter 7 Introduction(章节介绍)
- Item 42: Prefer lambdas to anonymous classes
- Item 43: Prefer method references to lambdas
- Item 44: Favor the use of standard functional interfaces
- Item 45: Use streams judiciously
- Item 46: Prefer side effect free functions in streams
- Item 47: Prefer Collection to Stream as a return type
- Item 48: Use caution when making streams parallel
- Chapter 8. Methods(方法)
- Chapter 8 Introduction(章节介绍)
- Item 49: Check parameters for validity
- Item 50: Make defensive copies when needed
- Item 51: Design method signatures carefully
- Item 52: Use overloading judiciously
- Item 53: Use varargs judiciously
- Item 54: Return empty collections or arrays not nulls
- Item 55: Return optionals judiciously
- Item 56: Write doc comments for all exposed API elements
- Chapter 9. General Programming(泛型编程)
- Chapter 9 Introduction(章节介绍)
- Item 57: Minimize the scope of local variables
- Item 58: Prefer for each loops to traditional for loops
- Item 59: Know and use the libraries
- Item 60: Avoid float and double if exact answers are required
- Item 61: Prefer primitive types to boxed primitives
- Item 62: Avoid strings where other types are more appropriate
- Item 63: Beware the performance of string concatenation
- Item 64: Refer to objects by their interfaces
- Item 65: Prefer interfaces to reflection
- Item 66: Use native methods judiciously
- Item 67: Optimize judiciously
- Item 68: Adhere to generally accepted naming conventions
- Chapter 10. Exceptions(异常)
- Chapter 10 Introduction(章节介绍)
- Item 69: Use exceptions only for exceptional conditions
- Item 70: Use checked exceptions for recoverable conditions and runtime exceptions for programming errors
- Item 71: Avoid unnecessary use of checked exceptions
- Item 72: Favor the use of standard exceptions
- Item 73: Throw exceptions appropriate to the abstraction
- Item 74: Document all exceptions thrown by each method
- Item 75: Include failure capture information in detail messages
- Item 76: Strive for failure atomicity
- Item 77: Don’t ignore exceptions
- Chapter 11. Concurrency(并发)
- Chapter 11 Introduction(章节介绍)
- Item 78: Synchronize access to shared mutable data
- Item 79: Avoid excessive synchronization
- Item 80: Prefer executors, tasks, and streams to threads
- Item 81: Prefer concurrency utilities to wait and notify
- Item 82: Document thread safety
- Item 83: Use lazy initialization judiciously
- Item 84: Don’t depend on the thread scheduler
- Chapter 12. Serialization(序列化)
- Chapter 12 Introduction(章节介绍)
- Item 85: Prefer alternatives to Java serialization
- Item 86: Implement Serializable with great caution
- Item 87: Consider using a custom serialized form
- Item 88: Write readObject methods defensively
- Item 89: For instance control prefer enum types to readResolve
- Item 90: Consider serialization proxies instead of serialized instances