Merge pull request #18077 from freekry

* pr/18077:
  Simplify some code

Closes gh-18077
This commit is contained in:
Stephane Nicoll
2019-09-01 09:06:15 +02:00
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);
}