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
100988c5
Commit
100988c5
authored
Jul 01, 2023
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove StreamUtils#toMap duplicate message
parent
5a58e3d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
commons/common-util/src/main/java/com/schbrain/common/util/StreamUtils.java
...l/src/main/java/com/schbrain/common/util/StreamUtils.java
+2
-6
No files found.
commons/common-util/src/main/java/com/schbrain/common/util/StreamUtils.java
View file @
100988c5
...
@@ -88,11 +88,7 @@ public class StreamUtils {
...
@@ -88,11 +88,7 @@ public class StreamUtils {
}
}
public
static
<
K
,
T
,
V
,
M
extends
Map
<
K
,
V
>>
Map
<
K
,
V
>
toMap
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
keyMapper
,
Function
<
T
,
V
>
valueMapper
,
Supplier
<
M
>
mapFactory
)
{
public
static
<
K
,
T
,
V
,
M
extends
Map
<
K
,
V
>>
Map
<
K
,
V
>
toMap
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
keyMapper
,
Function
<
T
,
V
>
valueMapper
,
Supplier
<
M
>
mapFactory
)
{
return
from
(
data
).
collect
(
Collectors
.
toMap
(
keyMapper
,
valueMapper
,
(
oldValue
,
newValue
)
->
{
return
from
(
data
).
collect
(
Collectors
.
toMap
(
keyMapper
,
valueMapper
,
(
oldValue
,
newValue
)
->
oldValue
,
mapFactory
));
// Could not get the key when mergeFunction invoke
log
.
warn
(
"There are multiple values with the same key when toMap, return the old one"
);
return
oldValue
;
},
mapFactory
));
}
}
public
static
<
K
,
T
>
Map
<
K
,
List
<
T
>>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
mapper
)
{
public
static
<
K
,
T
>
Map
<
K
,
List
<
T
>>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
mapper
)
{
...
@@ -156,4 +152,4 @@ public class StreamUtils {
...
@@ -156,4 +152,4 @@ public class StreamUtils {
return
StreamSupport
.
stream
(
source
.
spliterator
(),
parallel
);
return
StreamSupport
.
stream
(
source
.
spliterator
(),
parallel
);
}
}
}
}
\ No newline at end of file
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