Use toUnmodifiableSet and toList instead of collectingAndThen

Since Spring Framework 6 uses JDK 17 for its baseline, we can make use
of toList() and toUnmodifiableSet() which were introduced in JDK 16 and
JDK 10, respectively.

Closes gh-27618
This commit is contained in:
최유진(Yujin Choi)/Platform Engineering팀/11ST
2021-10-28 10:58:11 +09:00
committed by Sam Brannen
parent 5ea1cf532e
commit 8dd385b440
2 changed files with 3 additions and 5 deletions

View File

@@ -146,7 +146,7 @@ public abstract class YamlProcessor {
else {
Assert.noNullElements(supportedTypes, "'supportedTypes' must not contain null elements");
this.supportedTypes = Arrays.stream(supportedTypes).map(Class::getName)
.collect(Collectors.collectingAndThen(Collectors.toSet(), Collections::unmodifiableSet));
.collect(Collectors.toUnmodifiableSet());
}
}