public void sortChildrenByNode(Comparator<TreeNode<T>> comparator){
  Collections.sort(children,comparator);
  for (  TreeNode<T> child : children) {
    child.sortChildrenByNode(comparator);
  }
}

public void sortChildrenByNode ( Comparator < TreeNode < T > > comparator ) { Collections . sort ( children , comparator ) ; for ( TreeNode < T > child : children ) { child . sortChildrenByNode ( comparator ) ; } }
recursively sorts all children using the given comparator of treenode .
