Created
May 3, 2020 09:48
-
-
Save mudiadamz/215fb7307b242c225c5092985afadf54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package visitorpatern; | |
public class VisitorPattern { | |
public static void main(final String[] args) { | |
//visit all children nodes | |
StaticData.PERSON.acceptChildren(new PersonRecursiveVisitor() { | |
@Override | |
public void visit(Person person) { | |
//visit and print the person name | |
System.out.println(person.getName()); | |
super.visit(person); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment