Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-parent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
schbrain-parent
Commits
d676584c
Commit
d676584c
authored
Aug 31, 2023
by
panwangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NullPointExection Bug Fix
parent
2d444035
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
commons/common-util/src/main/java/com/schbrain/common/util/TreeUtils.java
...til/src/main/java/com/schbrain/common/util/TreeUtils.java
+3
-3
No files found.
commons/common-util/src/main/java/com/schbrain/common/util/TreeUtils.java
View file @
d676584c
...
...
@@ -76,14 +76,14 @@ public class TreeUtils {
public
static
<
T
,
E
>
List
<
E
>
buildNodeList
(
Collection
<
T
>
tree
,
Function
<
T
,
Collection
<
T
>>
childGetter
,
Function
<
T
,
E
>
mapper
)
{
List
<
E
>
nodes
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
tree
))
{
return
nodes
;
}
doBuildNodeList
(
tree
,
childGetter
,
mapper
,
nodes
);
return
nodes
;
}
private
static
<
E
,
T
>
void
doBuildNodeList
(
Collection
<
T
>
tree
,
Function
<
T
,
Collection
<
T
>>
childGetter
,
Function
<
T
,
E
>
mapper
,
List
<
E
>
nodes
)
{
if
(
CollectionUtils
.
isEmpty
(
tree
))
{
return
;
}
tree
.
forEach
(
node
->
{
nodes
.
add
(
mapper
.
apply
(
node
));
doBuildNodeList
(
childGetter
.
apply
(
node
),
childGetter
,
mapper
,
nodes
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment