mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
Update hutool-core/src/main/java/cn/hutool/core/tree/BeanTree.java
This commit is contained in:
parent
a631f7e915
commit
d5879a0abd
@ -126,8 +126,7 @@ public class BeanTree<T, R extends Comparable<R>> {
|
||||
public List<T> toTree(final List<T> list) {
|
||||
if (Objects.isNull(parentPredicate)) {
|
||||
final Map<R, List<T>> pIdValuesMap = EasyStream.of(list)
|
||||
.peek(e -> Objects.requireNonNull(idGetter.apply(e),
|
||||
() -> StrUtil.format("primary key {} must not null", LambdaUtil.getFieldName(idGetter))
|
||||
.peek(e -> Objects.requireNonNull(idGetter.apply(e), "The id of tree node must not be null")
|
||||
)).group(pidGetter);
|
||||
final List<T> parents = pIdValuesMap.getOrDefault(pidValue, new ArrayList<>());
|
||||
findChildren(list, pIdValuesMap);
|
||||
|
Loading…
x
Reference in New Issue
Block a user