Question
In Java, which comparison about Optional is accurate?
- There is no practical difference in behavior, performance, or API design when Optional is involved.
- The oldest option related to Optional is always the right production choice regardless of context.
- Differences around Optional are mostly cosmetic, so correctness and maintainability do not change.
- Optional is most useful for return types and fluent handling, not as a blanket replacement for all fields and parameters.
Hint
Focus on the behavior or tradeoff, not just the keyword.
Answer and rationale
Correct answer: D. Optional is most useful for return types and fluent handling, not as a blanket replacement for all fields and parameters.
Optional is most useful for return types and fluent handling, not as a blanket replacement for all fields and parameters. This is the comparison that usually separates memorization from understanding.
Track: Java