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
813d23ce
Commit
813d23ce
authored
May 19, 2023
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename method arguments
parent
dccd7414
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
commons/common-util/src/main/java/com/schbrain/common/util/StreamUtils.java
...l/src/main/java/com/schbrain/common/util/StreamUtils.java
+11
-11
No files found.
commons/common-util/src/main/java/com/schbrain/common/util/StreamUtils.java
View file @
813d23ce
...
...
@@ -36,8 +36,8 @@ public class StreamUtils {
return
toList
(
data
,
mapper
,
distinct
,
false
);
}
public
static
<
T
,
E
>
List
<
E
>
toList
(
Iterable
<
T
>
data
,
Function
<
T
,
E
>
mapper
,
boolean
distinct
,
boolean
ignore
Null
)
{
return
extract
(
data
,
mapper
,
distinct
,
ignore
Null
,
Collectors
.
toList
());
public
static
<
T
,
E
>
List
<
E
>
toList
(
Iterable
<
T
>
data
,
Function
<
T
,
E
>
mapper
,
boolean
distinct
,
boolean
discard
Null
)
{
return
extract
(
data
,
mapper
,
distinct
,
discard
Null
,
Collectors
.
toList
());
}
public
static
<
T
,
E
>
Set
<
E
>
toSet
(
Iterable
<
T
>
data
,
Function
<
T
,
E
>
mapper
)
{
...
...
@@ -88,8 +88,8 @@ public class StreamUtils {
return
groupBy
(
data
,
mapper
,
collectors
,
false
);
}
public
static
<
K
,
T
,
V
>
Map
<
K
,
V
>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
mapper
,
Collector
<
T
,
?,
V
>
collectors
,
boolean
ignore
NullKey
)
{
return
groupBy
(
data
,
mapper
,
Function
.
identity
(),
collectors
,
ignore
NullKey
);
public
static
<
K
,
T
,
V
>
Map
<
K
,
V
>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
mapper
,
Collector
<
T
,
?,
V
>
collectors
,
boolean
discard
NullKey
)
{
return
groupBy
(
data
,
mapper
,
Function
.
identity
(),
collectors
,
discard
NullKey
);
}
public
static
<
K
,
T
,
V
>
Map
<
K
,
List
<
V
>>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
keyMapper
,
Function
<
T
,
V
>
valueMapper
)
{
...
...
@@ -104,13 +104,13 @@ public class StreamUtils {
return
groupBy
(
data
,
keyMapper
,
valueMapper
,
collector
,
false
);
}
public
static
<
K
,
T
,
V
,
C
>
Map
<
K
,
C
>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
keyMapper
,
Function
<
T
,
V
>
valueMapper
,
Collector
<
V
,
?,
C
>
collector
,
boolean
ignore
NullKey
)
{
return
groupBy
(
data
,
keyMapper
,
valueMapper
,
collector
,
ignore
NullKey
,
HashMap:
:
new
);
public
static
<
K
,
T
,
V
,
C
>
Map
<
K
,
C
>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
keyMapper
,
Function
<
T
,
V
>
valueMapper
,
Collector
<
V
,
?,
C
>
collector
,
boolean
discard
NullKey
)
{
return
groupBy
(
data
,
keyMapper
,
valueMapper
,
collector
,
discard
NullKey
,
HashMap:
:
new
);
}
public
static
<
K
,
T
,
V
,
C
>
Map
<
K
,
C
>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
keyMapper
,
Function
<
T
,
V
>
valueMapper
,
Collector
<
V
,
?,
C
>
collector
,
boolean
ignore
NullKey
,
Supplier
<
Map
<
K
,
C
>>
mapSupplier
)
{
public
static
<
K
,
T
,
V
,
C
>
Map
<
K
,
C
>
groupBy
(
Iterable
<
T
>
data
,
Function
<
T
,
K
>
keyMapper
,
Function
<
T
,
V
>
valueMapper
,
Collector
<
V
,
?,
C
>
collector
,
boolean
discard
NullKey
,
Supplier
<
Map
<
K
,
C
>>
mapSupplier
)
{
Stream
<
T
>
stream
=
from
(
data
);
if
(
ignore
NullKey
)
{
if
(
discard
NullKey
)
{
stream
=
stream
.
filter
(
item
->
null
!=
keyMapper
.
apply
(
item
));
}
return
stream
.
collect
(
groupingBy
(
keyMapper
,
mapSupplier
,
mapping
(
valueMapper
,
collector
)));
...
...
@@ -128,9 +128,9 @@ public class StreamUtils {
return
from
(
data
).
map
(
toStringFunction
).
collect
(
joining
(
delimiter
,
prefix
,
suffix
));
}
public
static
<
T
,
E
,
R
>
R
extract
(
Iterable
<
T
>
data
,
Function
<
T
,
E
>
mapper
,
boolean
distinct
,
boolean
ignore
Null
,
Collector
<
E
,
?,
R
>
collector
)
{
public
static
<
T
,
E
,
R
>
R
extract
(
Iterable
<
T
>
data
,
Function
<
T
,
E
>
mapper
,
boolean
distinct
,
boolean
discard
Null
,
Collector
<
E
,
?,
R
>
collector
)
{
Predicate
<
E
>
predicate
=
null
;
if
(
ignore
Null
)
{
if
(
discard
Null
)
{
predicate
=
Objects:
:
nonNull
;
}
return
extract
(
data
,
mapper
,
predicate
,
distinct
,
collector
);
...
...
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