Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
6013146a
Commit
6013146a
authored
Dec 21, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15543 from igor-suhorukov
* pr/15543: Simplify code by using Map computeIfAbsent
parents
b8c82ec4
cbf6b330
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
10 deletions
+2
-10
TypeElementMembers.java
...ework/boot/configurationprocessor/TypeElementMembers.java
+1
-5
ConfigurationMetadata.java
...onfigurationprocessor/metadata/ConfigurationMetadata.java
+1
-5
No files found.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java
View file @
6013146a
...
...
@@ -104,11 +104,7 @@ class TypeElementMembers {
else
if
(
isSetter
(
method
))
{
String
propertyName
=
getAccessorName
(
name
);
List
<
ExecutableElement
>
matchingSetters
=
this
.
publicSetters
.
get
(
propertyName
);
if
(
matchingSetters
==
null
)
{
matchingSetters
=
new
ArrayList
<>();
this
.
publicSetters
.
put
(
propertyName
,
matchingSetters
);
}
.
computeIfAbsent
(
propertyName
,
(
k
)
->
new
ArrayList
<>());
TypeMirror
paramType
=
method
.
getParameters
().
get
(
0
).
asType
();
if
(
getMatchingSetter
(
matchingSetters
,
paramType
)
==
null
)
{
matchingSetters
.
add
(
method
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java
View file @
6013146a
...
...
@@ -136,11 +136,7 @@ public class ConfigurationMetadata {
}
private
<
K
,
V
>
void
add
(
Map
<
K
,
List
<
V
>>
map
,
K
key
,
V
value
)
{
List
<
V
>
values
=
map
.
get
(
key
);
if
(
values
==
null
)
{
values
=
new
ArrayList
<>();
map
.
put
(
key
,
values
);
}
List
<
V
>
values
=
map
.
computeIfAbsent
(
key
,
(
k
)
->
new
ArrayList
<>());
values
.
add
(
value
);
}
...
...
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