Last active
August 3, 2019 12:56
-
-
Save HarshadRanganathan/6ef00c1f95e8225cdc9f68671b0b9a29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chapter: Creating and Destroying Objects | |
[1] Consider static factory methods instead of constructors | |
[2] Consider a builder when faced with many constructor parameters | |
[3] Enforce the singleton property with a private constructor or an enum type | |
[4] Enforce non-instantiability with a private constructor | |
[5] Prefer dependency injection to hardwiring resources | |
[6] Avoid creating unnecessary objects | |
[7] Eliminate obsolete object references | |
[8] Avoid finalizers and cleaners | |
[9] Prefer try-with-resources to try-finally | |
Chapter: Methods Common to All Objects | |
[1] Obey the general contract when overriding equals | |
[2] Always override hashCode when you override equals | |
[3] Always override toString | |
[4] Override clone judiciuosly |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment