public List depthFirst(boolean preorder){
  List answer=new NodeList();
  if (preorder)   answer.add(this);
  answer.addAll(depthFirstRest(preorder));
  if (!preorder)   answer.add(this);
  return answer;
}

public List depthFirst ( boolean preorder ) { List answer = new NodeList ( ) ; if ( preorder ) answer . add ( this ) ; answer . addAll ( depthFirstRest ( preorder ) ) ; if ( ! preorder ) answer . add ( this ) ; return answer ; }
provides a collection of all the nodes in the tree using a depth - first traversal .
