Practice ยท 3 of 3
Self-typed fluent API
Inside Solution, write:
1. abstract static class Node<Self extends Node<Self>> with an INSTANCE-level
List<String> labels and public Self label(String l) that records the label and
returns (Self) this (annotated @SuppressWarnings("unchecked")).
2. static class Task extends Node<Task> with public String describe() returning
"Task" + labels (e.g. Task[a, b]).
3. static class Job extends Node<Job> with describe() prefixing "Job".
Instances must NOT share state: labeling one object must never appear in another's
describe().
Difficulty: advanced
Press Submit to check your solution.
Back to lesson: Practice: Type-system drills