Effective Java Chapter 2

Chapter 2. Creating and deleting objects

1. Consider creating a static factory method instead of a constructor

2. Use builder when constructor arguments are huge

3. When designing a singleton class, make the constructor private or use ENUM.

4. Create a private constructor for the class you want to suppress instantiation

5. Dependency Injection should be done rather than hard-coding resources

6. Avoid unnecessary object creation

7. Discard references that are no longer in use

8. Avoid using finalizer and cleaner

9. Use try-with-resources rather than try-finally

Recommended Posts

Effective Java Chapter 2
Effective Java Chapter 6 34-35
Effective Java Chapter 4 15-22
Effective Java Chapter 3
Effective Java 3rd Edition Chapter 5 Generics
Effective Java 3rd Edition Chapter 8 Methods
[Read Effective Java] Chapter 2 Item 7 "Avoid Finalizers"
Effective Java 3rd Edition Chapter 9 Program General
Java Performance Chapter 1 Introduction
effective java 3rd summary
Builder pattern (Effective Java)
Java Performance Chapter 3 Java Performance Toolbox
Effective Java 3rd Edition Chapter 6 enums and annotations
Effective Java 3rd Edition Chapter 4 Classes and Interfaces
[Read Effective Java] Chapter 3 Item 10 "Always Override toString"
Effective Java 3rd Edition Chapter 7 Lambda and Streams
I started Java Gold (Chapter 1-1)
[Read Effective Java] Chapter 3 Item 12 "Considering Implementation of Comparable"
[Read Effective Java] Chapter 2 Item 6 "Remove obsolete object references"
Java Performance Chapter 2 Performance Testing Approach
Java
Effective Java 3rd Edition Chapter 2 Object Creation and Disappearance
Java
From Ineffective Java to Effective Java
Effective Java 3rd Edition Chapter 3 Methods Common to All Objects
[Effective Java] Remove obsolete object references
Java Performance Chapter 5 Garbage Collection Basics
[Effective Java] Avoid creating unnecessary objects
[Read Effective Java] Chapter 2 Item 4 "Force uninstantiation with a private constructor"
[Read Effective Java] Chapter 3 Item 9 "When overriding equals, always override hashCode"
[Read Effective Java] Chapter 2 Item 5 "Avoid the creation of unnecessary objects"
Java learning (0)
Studying Java ―― 3
[Java] array
Java protected
[Java] Annotation
[Java] Module
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Java methods
Java method
java (constructor)
Java array
[Java] ArrayDeque
java (override)
java (method)
Java Day 2018
Java string
java (array)
Java static
Java serialization
java beginner 4
[Read Effective Java] Chapter 2 Item 1 "Consider static factory methods instead of constructors"
JAVA paid
Studying Java ―― 4
Java (set)
java shellsort
[Java] compareTo
Studying Java -5
java reflexes