Skip to content
Exploration of Effective Java, third edition
Java Kotlin
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src [06] Create benchmark for OffestDateTime::parse May 25, 2019
.gitignore [06] Create benchmark for recreation/reuse of reg ex patterns May 24, 2019
LICENSE Initialize project Sep 19, 2018 Update to Java 11 May 24, 2019
pom.xml Update to Java 11 May 24, 2019

Effective Java

This project contains examples, tests, and benchmarks for my YouTube series on Effective Java, Third Edition. The tests can be run with mvn test or any IDE with JUnit 5 integration. To run the benchmarks:

mvn package
java -jar target/benchmarks.jar

Related links:

Creating and destroying objects

  • Item 1: Consider static factory methods instead of constructors - examples
  • Item 2: Consider a builder when faced with many constructor parameters - examples
  • Items 3-5 - examples:
    • Enforce the singleton property with a private constructor or an enum type
    • Enforce noninstantiability with a private constructor
    • Prefer dependency injection to hardwiring resources
  • Item 6: Avoid creating unnecessary objects - benchmark


  • Item 50: Make defensive copies when needed - example and tests
You can’t perform that action at this time.