先定义一个Tree对象,不同的Response去继承这个对象
import java.util.ArrayList;
import java.util.List;
public class Tree {
protected List children = new ArrayList();
protected List parent = new ArrayList();
public Tree() {
}
protected Object getTreeId() {
return null;
}
protected Object getTreeParentId() {
return null;
}
public List getParentList() {
return this.parent;
}
public List getChildren() {
return this.children;
}
protected boolean topParentId() {
return "0".equals(this.getTreeParentId());
}
}
封装通用的树结构工具类
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.functio
版权声明:本文为lucky_love816原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。