美文网首页
Effective Java

Effective Java

作者: YoungJadeStone | 来源:发表于2019-01-21 09:33 被阅读0次

这篇文章意在列出笔者关于《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 泛型

Chapter 6: Enums and Annotations 枚举和注释

  • Item 30: Use enums instead of int constants 用枚举来表示整数形常数
  • Item 31: Use instance fields instead of ordinals 用实例域代替序数
  • Item 32: Use EnumSet instead of bit fields 用EnumSet代替位域

相关文章

网友评论

      本文标题:Effective Java

      本文链接:https://www.haomeiwen.com/subject/okmqjqtx.html