/EffectiveJava

The examples in this repo are based on Joshua J. Bloch's book Effective Java (Third Edition)

Primary LanguageJava

Effective Java

The examples in this repo are based on Joshua J. Bloch's book Effective Java (Third Edition).

Note: In the book, examples start from chapter 2, in the repo they start from chapter 1.

Chapter 0: Introduction

Chapter 1: Creating and Destroying Objects

item1 : Consider static factory methods instead of constructors

item2 : Consider a builder when faced with many constructor parameters

item3 : Enforce the singleton property with a private constructor or an enum type

item4 : Enforce noninstantiability with a private constructor

item5 : Prefer dependency injection to hardwring resources

item6 : Avoid creating unnecessary objects

item7 : Eliminate obsolete object references

item8 : Avoid finalizers and cleaners

item9 : Prefer try-with-resources to try-finally

Chapter 2: Methods Common to All Objects

item10: Obey the general contract when overriding equals

item11: Always override hashCode when you override equals

item12: Always override toString

item13: Override clone judiciously

item14: Consider implementing Comparable

item14-b: Comparable

Chapter 3: Classes and Interfaces

Chapter 4: Generics

Chapter 5: Enums and Annotations

Chapter 6: Lambdas and Streams

Chapter 7: Methods

Chapter 8: General Programming

Chapter 9: Exceptions

Chapter 10: Concurrency

Chapter 11: Serialization