1 public class TreeTester
2 {
3 public static void main(String[] args)
4 {
5 BinarySearchTree<String> names = new BinarySearchTree<String>();
6 names.add("Romeo");
7 names.add("Juliet");
8 names.add("Tom");
9 names.add("Dick");
10 names.add("Harry");
11
12 class PrintVisitor implements Visitor<String>
13 {
14 public void visit(String data)
15 {
16 System.out.print(data + " ");
17 }
18 }
19
20 names.inorder(new PrintVisitor());
21 System.out.println();
22
23 System.out.println("Expected: Dick Harry Juliet Romeo Tom");
24 }
25 }