iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
88.23k stars 26.18k forks source link

Refactor Visitor #2975

Closed iluwatar closed 1 day ago

iluwatar commented 4 weeks ago

Description

VisitorTest has some code smells regarding Optional usage.

  1. Optional<String> has been used as class field type.
  2. Optional<String> has been used as parameter type.

Optional is primarily intended for use as a method return type where there is a clear need to represent "no result," and where using null is likely to cause errors. A variable whose type is Optional should never itself be null; it should always point to an Optional instance.

Acceptance Criteria

ankurnotwarikoo commented 3 weeks ago

Can this be assigned to me ?

Joel-Dandin commented 6 days ago

Hi @iluwatar, I've noticed that this issue has been unresolved for a while. I've made some changes to the code and hope they address the problem.