By using Visitor design pattern we can add new virtual methods to
existing classes without modifying their core structure.
In JDK there are many places where Visitor design pattern is used.
Some of these are as follows:
javax.lang.model.element.AnnotationValue and
AnnotationValueVisitor
java.nio.file.FileVisitor and SimpleFileVisitor
javax.lang.model.type.TypeMirror and TypeVisitor
javax.lang.model.element.Element and ElementVisitor
javax.faces.component.visit.VisitContext and
VisitCallbac
https://refactoring.guru/design-patterns/visitor/java/example