public List<HeaderManagerVO> flattenList(List<HeaderManagerVO> treeList) {
List<HeaderManagerVO> flatList = new ArrayList<>();
int a=1;
for (HeaderManagerVO node : treeList) {
node.setOrderNum(a++);
flatList.add(node);
if (node.getChildren() != null && ! node.getChildren().isEmpty()) {
flatList.addAll(flattenList(node.getChildren()));
}
}
return flatList;
}
java tree结构数据 转换为普通集合 并排序
最新推荐文章于 2024-08-23 00:00:00 发布