My own examples from Effective Java by Joshua Bloch using TDD.
- Item 1 - Consider static factory methods instead of constructors
- Item 2 - Consider a builder when face with many constructor parameters
- Item 3 - Enforce the singleton property with a private constructor or an enum type
- Item 4 - Enforce noninstantiability with a private constructor
- Item 5 - Avoid creating unnecessary objects
- Item 8 - Obey the general contract when overriding equals
- Item 9 - Always override hashCode when you override equals
- Item 10 - Always override toString
- Item 11 - Override clone judiciously
- Item 12 - Consider implementing Comparabale
- Item 15 - Minimize Mutability
- Item 18 - Prefer interfaces to abstract classes
- Item 38 - Check parameters for validity
- Item 41 - Use overloading judiciously
- Item 43 - Return empty arrays or collections, not nulls
- Item 58 - Use checked exceptions for recoverable conditions and runtime exceptions for programming errors
- Item 59 - Avoid unnecessary use of checked exceptions
- Item 60 - Favor the use of standard exceptions