Skip to main content

Checkpoint: Object Contracts

intermediate15 min readLesson 66 of 180

Graded checkpoint: repair a broken value class and count distinct settings correctly.

Checkpoint — object contracts

You can now: distinguish identity from equality, pair equals with hashCode, and build immutable classes that do not leak mutability. Prove it by fixing a class whose hash contract and API boundaries are both broken.