Prefer List.sort(Comparator) over Collections.sort(List, Comparator)

This commit is contained in:
Juergen Hoeller
2018-02-16 10:23:18 +01:00
parent b35274f5a7
commit 8d3264f680
25 changed files with 71 additions and 96 deletions

View File

@@ -540,7 +540,7 @@ class ConfigurationClassParser {
return;
}
Collections.sort(deferredImports, DEFERRED_IMPORT_COMPARATOR);
deferredImports.sort(DEFERRED_IMPORT_COMPARATOR);
for (DeferredImportSelectorHolder deferredImport : deferredImports) {
ConfigurationClass configClass = deferredImport.getConfigurationClass();
try {

View File

@@ -365,7 +365,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
if (logger.isInfoEnabled()) {
logger.info("Stopping beans in phase " + this.phase);
}
Collections.sort(this.members, Collections.reverseOrder());
this.members.sort(Collections.reverseOrder());
CountDownLatch latch = new CountDownLatch(this.smartMemberCount);
Set<String> countDownBeanNames = Collections.synchronizedSet(new LinkedHashSet<>());
for (LifecycleGroupMember member : this.members) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -260,7 +260,7 @@ class PostProcessorRegistrationDelegate {
if (comparatorToUse == null) {
comparatorToUse = OrderComparator.INSTANCE;
}
Collections.sort(postProcessors, comparatorToUse);
postProcessors.sort(comparatorToUse);
}
/**