无论是在linux和window中都有的这种树形输出形式,个人感觉相当好用,偶然想起来,尝试做一下树形输出效果,下面是具体代码
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class mappingtool {
public static void main(String[] args) {
layer m = new layer("project");
m.addNext(new layer("num 1"));
m.addNext(new layer("num 2"));
m.addNext(new layer("num 3"));
layer layer1 = m.getLayerByNum(1);
layer1.addNext(new layer("1.1"));
layer1.addNext(new layer("1.2"));
layer1.addNext(new layer("1.3"));
layer layer1_1 = layer1.getLayerByNum(1);
layer1_1.addNext(new layer("1.1.1"));