June 2018
Intermediate to advanced
316 pages
6h 34m
English
Let's decompile our ImmutableKey to Java. The first lines look as follows:
final class ImmutableKey { @Nullable private final String name; @Nullable public final String getName() { return this.name; } public ImmutableKey(@Nullable String name) { this.name = name; }....................
In the preceding snippet, we can see that the ImmutableKey class contains the name field with a getter and a constructor. The name field is marked with the final modifier; thus, it's initialized when a new instance is created, and after this, its value can't be changed.
The decompiled ImmutableKey also overrides a version of the toString method:
public String toString() { return "ImmutableKey(name=" + this.name + ")";}
The ImmutableKey method also ...
Read now
Unlock full access