代码优化

This commit is contained in:
如梦技术 2018-12-27 11:35:17 +08:00 committed by 如梦技术
parent a9dcbaacec
commit 083b42c2fb

View File

@ -13,7 +13,7 @@ import java.util.List;
public class NodeTest { public class NodeTest {
public static void main(String[] args) { public static void main(String[] args) {
List<INode> list = new ArrayList<>(); List<ForestNode> list = new ArrayList<>();
list.add(new ForestNode(1, 0, "1")); list.add(new ForestNode(1, 0, "1"));
list.add(new ForestNode(2, 0, "2")); list.add(new ForestNode(2, 0, "2"));
list.add(new ForestNode(3, 1, "3")); list.add(new ForestNode(3, 1, "3"));
@ -24,11 +24,10 @@ public class NodeTest {
list.add(new ForestNode(8, 5, "8")); list.add(new ForestNode(8, 5, "8"));
list.add(new ForestNode(9, 6, "9")); list.add(new ForestNode(9, 6, "9"));
list.add(new ForestNode(10, 9, "10")); list.add(new ForestNode(10, 9, "10"));
List<INode> tns = ForestNodeMerger.merge(list); List<ForestNode> tns = ForestNodeMerger.merge(list);
tns.forEach(node -> { tns.forEach(node ->
ForestNode n = (ForestNode) node; System.out.println(JsonUtil.toJson(node))
System.out.println(JsonUtil.toJson(n)); );
});
} }
} }