Polish "Remove redundant null check for sorter"

See gh-43343
This commit is contained in:
Moritz Halbritter
2024-12-02 11:39:37 +01:00
parent bd367803d1
commit 07bc5f2563

View File

@@ -90,9 +90,8 @@ public abstract class Configurations {
protected Configurations(UnaryOperator<Collection<Class<?>>> sorter, Collection<Class<?>> classes,
Function<Class<?>, String> beanNameGenerator) {
Assert.notNull(classes, "Classes must not be null");
sorter = (sorter != null) ? sorter : UnaryOperator.identity();
Collection<Class<?>> sorted = sorter.apply(classes);
this.sorter = sorter;
this.sorter = (sorter != null) ? sorter : UnaryOperator.identity();
Collection<Class<?>> sorted = this.sorter.apply(classes);
this.classes = Collections.unmodifiableSet(new LinkedHashSet<>(sorted));
this.beanNameGenerator = beanNameGenerator;
}