java显示树结构


/**
* 显示多颗树的所有节点的信息
*
* @param departmentList
*/
private void showTreeList(Collection<Department>departmentList) {
for (Department top : departmentList) {
// 顶点
System.out.println(top.getName());
// 子树
showTreeList(top.getChildren());
}
}

posted @ 2016-09-05 23:22  江山一族  阅读(1165)  评论(0编辑  收藏  举报