The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Danny G (3) [Avatar] Offline
#1
Currently code sample is:

public final class ImmutableHello {
  public ImmutableHello(String name) {
    this.name = name;
  }
  public String getName() {
    return name;
  }
}


Looks like this is missing a
private final String name;
declaration.

You may also want to mention java libraries such as Immutables and AutoValue as yet another alternative to creating immutable classes (as also recommended by Lightbend). I wouldn't think you'd have to go into any details, but IMHO these help remove Java boilerplate immensely and provide correct immutable implementations.