Java 8: Collections.sort() can be replaced with List.sort()

This commit is contained in:
Lars Grefer 2019-08-09 00:49:26 +02:00 committed by Rob Winch
parent 25c06be1eb
commit 3a5d8ba696
5 changed files with 5 additions and 5 deletions

View File

@ -134,7 +134,7 @@ public abstract class SecurityConfigurerAdapter<O, B extends SecurityBuilder<O>>
private boolean addObjectPostProcessor(
ObjectPostProcessor<? extends Object> objectPostProcessor) {
boolean result = this.postProcessors.add(objectPostProcessor);
Collections.sort(postProcessors, AnnotationAwareOrderComparator.INSTANCE);
postProcessors.sort(AnnotationAwareOrderComparator.INSTANCE);
return result;
}
}

View File

@ -129,7 +129,7 @@ public class AuthenticationConfiguration {
@Autowired(required = false)
public void setGlobalAuthenticationConfigurers(
List<GlobalAuthenticationConfigurerAdapter> configurers) throws Exception {
Collections.sort(configurers, AnnotationAwareOrderComparator.INSTANCE);
configurers.sort(AnnotationAwareOrderComparator.INSTANCE);
this.globalAuthConfigurers = configurers;
}

View File

@ -2327,7 +2327,7 @@ public final class HttpSecurity extends
@Override
protected DefaultSecurityFilterChain performBuild() throws Exception {
Collections.sort(filters, comparator);
filters.sort(comparator);
return new DefaultSecurityFilterChain(requestMatcher, filters);
}

View File

@ -139,7 +139,7 @@ public class WebSecurityConfiguration implements ImportAware, BeanClassLoaderAwa
webSecurity.debug(debugEnabled);
}
Collections.sort(webSecurityConfigurers, AnnotationAwareOrderComparator.INSTANCE);
webSecurityConfigurers.sort(AnnotationAwareOrderComparator.INSTANCE);
Integer previousOrder = null;
Object previousConfig = null;

View File

@ -164,7 +164,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
unorderedFilterChain.addAll(authBldr.getFilters());
unorderedFilterChain.addAll(buildCustomFilterList(element, pc));
Collections.sort(unorderedFilterChain, new OrderComparator());
unorderedFilterChain.sort(new OrderComparator());
checkFilterChainOrder(unorderedFilterChain, pc, pc.extractSource(element));
// The list of filter beans