View on GitHub

Practical Functional Java

Examples and exercises for the "Practical Functional Java" workshop

Immutable Objects Exercises

The goal of this exercise is to get comfortable creating immutable objects.

Overview of the Exercise

In this exercise you will create an object “ImmutablePerson” with the following characteristics:

  1. Required first name
  2. Optional middle name
  3. Required last name
  4. Optional list of nicknames

Solutions are available in src/main/java/solutions/basics/immutable/ImmutablePerson.java

Exercises

  1. Uncomment the tests in src/test/java/exercises/basics/immutable/BasicImmutableTest.java
  2. Fill in the object src/main/java/exercises/basics/immutable/ImmutablePerson.java so that the tests pass