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

@@ -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.
@@ -23,7 +23,6 @@ import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -248,7 +247,7 @@ public class VersionResourceResolver extends AbstractResourceResolver {
}
if (!matchingPatterns.isEmpty()) {
Comparator<String> comparator = this.pathMatcher.getPatternComparator(path);
Collections.sort(matchingPatterns, comparator);
matchingPatterns.sort(comparator);
return this.versionStrategyMap.get(matchingPatterns.get(0));
}
return null;