java显示树结构

/**

* 显示多颗树的所有节点的信息

*

* @param departmentList

*/

private void showTreeList(Collection<Department>departmentList) {

for (Department top : departmentList) {

// 顶点

System.out.println(top.getName());

// 子树

showTreeList(top.getChildren());

}

}