100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > java组装树状结构数据集合_JAVA构建List集合为树形结构

java组装树状结构数据集合_JAVA构建List集合为树形结构

时间:2019-10-26 13:39:58

相关推荐

java组装树状结构数据集合_JAVA构建List集合为树形结构

package com.zving.tree;

import java.util.ArrayList;

import java.util.List;

/**

* 树形结构实体类

* @author clove

*/

public class Node {

private int id;

private int pid;

private String name;

private String type;

private List children = new ArrayList<>();

public Node(int id, int pid) {

this.id = id;

this.pid = pid;

}

public Node(int id, int pid, String name, String type) {

this(id, pid);

this.name = name;

this.type = type;

}

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public int getPid() {

return pid;

}

public void setPid(int pid) {

this.pid = pid;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getType() {

return type;

}

public void setType(String type) {

this.type = type;

}

public List getChildren() {

return children;

}

public void setChildren(List children) {

this.children = children;

}

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。