private void DFSTree(List<BtBranchCompany> list,int start,int end,int step){
    if (start>=end)
        return;
    List<BtBranchCompany> fliter = list.stream().filter(e -> e.getLevelCode().length()==start).collect(Collectors.toList());
    for (BtBranchCompany btBranchCompany : fliter) {
        List<BtBranchCompany> child = allList.stream().filter(e -> e.getLevelCode().length()==(start + step) && e.getLevelCode().substring(0, start).equals(btBranchCompany.getLevelCode())).collect(Collectors.toList());
        btBranchCompany.setChildren(child);
        DFSTree(child,start+step,end,step);
    }
}
最后修改:2022 年 08 月 31 日
如果觉得我的文章对你有用,请随意赞赏