Strategic Object Creation and Immutability
This chapter continues our quest to find ways to get the most performance out of our Java applications. Creating objects is a core part of all Java applications, so the goal is not to eradicate that; rather, it is to take a strategic approach to object creation.
How and when we create objects can play a crucial role in application performance. Object creation impacts not only performance but also overall efficiency, garbage collection, and memory use. This chapter intends to provide you with the knowledge and skills you’ll need to implement an object creation strategy.
A core part of object creation strategies is the concept of object immutability. This chapter presents information and examples on how to make objects immutable and explains why you should consider it.
This chapter covers the following main topics:
- Minimizing object creation
- Object immutability
- Garbage collection
- Design patterns
By...