This commit is contained in:
Looly
2021-12-05 23:34:14 +08:00
parent 1ee2d5d257
commit 3fefdf5151
2 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package cn.hutool.core.lang.tree;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Console;
import org.junit.Assert;
import org.junit.Test;
@@ -109,12 +110,12 @@ public class TreeTest {
// 经过过滤,生成新的树
Tree<String> newTree = tree.filterNew((t)->{
final CharSequence name = t.getName();
return null != name && name.toString().contains("管理");
return null != name && name.toString().contains("店铺");
});
List<String> ids = new ArrayList<>();
newTree.walk((tr)-> ids.add(tr.getId()));
Assert .assertEquals(6, ids.size());
Assert .assertEquals(4, ids.size());
List<String> ids2 = new ArrayList<>();
tree.walk((tr)-> ids2.add(tr.getId()));