list转换

List<SysDept> deptTrees;
deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
TreeSelect是需要转换的list
public TreeSelect(SysDept dept)
    {
        this.id = dept.getDeptId();
//        this.level = dept.getLevel();
        this.label = dept.getDeptName();
        this.status = dept.getStatus();
        this.fbfbm = dept.getFbfbm();
    }

  

TreeSelect中新建构造方法。把需要复制的属性一一赋值。
posted @ 2020-12-17 17:14  小尼  阅读(397)  评论(0编辑  收藏  举报