
public static List treeToList(Listlist) { List result = new ArrayList<>(); for(T test : list) { List c = test.getChildren(); result.add(test); if (!CollectionUtils.isEmpty(c)) { result.addAll(treeToList(c)); test.setChildren(null); } } return result; }
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)