Simplify some code

See gh-18077
This commit is contained in:
freekry 2019-08-31 20:02:18 +08:00 committed by Stephane Nicoll
parent 58734873dd
commit e1611287c8
2 changed files with 2 additions and 8 deletions

View File

@ -54,10 +54,7 @@ class IncludeExcludeGroupMemberPredicate implements Predicate<String> {
if (names == null) {
return Collections.emptySet();
}
Set<String> cleaned = new LinkedHashSet<>(names.size());
for (String name : names) {
cleaned.add(name);
}
Set<String> cleaned = new LinkedHashSet<>(names);
return Collections.unmodifiableSet(cleaned);
}

View File

@ -109,10 +109,7 @@ class SpringBootMockMvcBuilderCustomizerTests {
@Override
public void write(List<String> lines) {
List<String> written = new ArrayList<>();
for (String line : lines) {
written.add(line);
}
List<String> written = new ArrayList<>(lines);
synchronized (this.monitor) {
this.allWritten.add(written);
}