// Textbook fragment 07.09 public static String toStringPreorder(Tree T, Position v) { String s = v.element().toString(); // the main "visit" action for (Position w : T.children(v)) s += ", " + toStringPreorder(T, w); return s; }