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:
parent
5ea1cf532e
commit
8dd385b440
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -25,7 +25,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
|
@ -157,8 +156,7 @@ public final class SpringFactoriesLoader {
|
|||
}
|
||||
|
||||
// Replace all lists with unmodifiable lists containing unique elements
|
||||
result.replaceAll((factoryType, implementations) -> implementations.stream().distinct()
|
||||
.collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList)));
|
||||
result.replaceAll((factoryType, implementations) -> implementations.stream().distinct().toList());
|
||||
cache.put(classLoader, result);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue