List<Node> results 這個有什么用?
public List<Node> build(){
??????? buildTree(root);
???????
??? }
??? private void buildTree(Node parent){
??????? Node node=null;
??????? Iterator<Node> it=nodes.iterator();
??????? while (it.hasNext()){
??????????? node=it.next();
??????????? if(Objects.equals(node.getParentId(),parent.getId())){
??????????????? parent.getChildren().add(node);
??????????? }
??????????? buildTree(node);
??????? }
??? }
2018-05-22
對應(yīng)前端頁面數(shù)據(jù)使用。不同的前端數(shù)據(jù)展示不同,樹形結(jié)果的數(shù)據(jù)封裝就不同哦。。??梢愿鶕?jù)自己的產(chǎn)品需求自己變化封裝樹形數(shù)據(jù)。