Appendix: Items Corresponding to Second Edition

Second Edition Item Number

Third Edition Item Number, Title

1

1, Consider static factory methods instead of constructors

2

2, Consider a builder when faced with many constructor parameters

3

3, Enforce the singleton property with a private constructor or an enum type

4

4, Enforce noninstantiability with a private constructor

5

6, Avoid creating unnecessary objects

6

7, Eliminate obsolete object references

7

8, Avoid finalizers and cleaners

8

10, Obey the general contract when overriding equals

9

11, Always override hashCode when you override equals

10

12, Always override toString

11

13, Override clone judiciously

12

14, Consider implementing Comparable

13

15, Minimize ...

Get Effective Java, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.