diff --git a/spring-core/src/test/java/org/springframework/core/annotation/OrderSourceProviderTests.java b/spring-core/src/test/java/org/springframework/core/annotation/OrderSourceProviderTests.java index edbea15e940..75b16db2932 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/OrderSourceProviderTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/OrderSourceProviderTests.java @@ -43,7 +43,7 @@ class OrderSourceProviderTests { C c2 = new C(-5); items.add(c); items.add(c2); - Collections.sort(items, comparator); + items.sort(comparator); assertOrder(items, c2, c); } @@ -54,7 +54,7 @@ class OrderSourceProviderTests { B b = new B(); List items = Arrays.asList(a, c, b); - Collections.sort(items, comparator.withSourceProvider(obj -> null)); + items.sort(comparator.withSourceProvider(obj -> null)); assertOrder(items, c, a, b); } @@ -65,7 +65,7 @@ class OrderSourceProviderTests { B b = new B(); List items = Arrays.asList(a, c, b); - Collections.sort(items, comparator.withSourceProvider(obj -> { + items.sort(comparator.withSourceProvider(obj -> { if (obj == a) { return new C(4); } @@ -84,7 +84,7 @@ class OrderSourceProviderTests { C c2 = new C(-5); List items = Arrays.asList(a, c, c2); - Collections.sort(items, comparator.withSourceProvider(obj -> { + items.sort(comparator.withSourceProvider(obj -> { if (obj == a) { return 4; } diff --git a/spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java b/spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java index 840e10f7c98..baf822ede42 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java @@ -99,7 +99,7 @@ class ConvertingComparatorTests { void shouldGetMapEntryKeys() throws Exception { ArrayList> list = createReverseOrderMapEntryList(); Comparator> comparator = ConvertingComparator.mapEntryKeys(new ComparableComparator()); - Collections.sort(list, comparator); + list.sort(comparator); assertThat(list.get(0).getKey()).isEqualTo("a"); } @@ -107,7 +107,7 @@ class ConvertingComparatorTests { void shouldGetMapEntryValues() throws Exception { ArrayList> list = createReverseOrderMapEntryList(); Comparator> comparator = ConvertingComparator.mapEntryValues(new ComparableComparator()); - Collections.sort(list, comparator); + list.sort(comparator); assertThat(list.get(0).getValue()).isEqualTo(1); } diff --git a/spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java b/spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java index a67ebf37966..4bda118b870 100644 --- a/spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java +++ b/spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java @@ -510,56 +510,56 @@ class AntPathMatcherTests { paths.add(null); paths.add("/hotels/new"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/new"); assertThat(paths.get(1)).isNull(); paths.clear(); paths.add("/hotels/new"); paths.add(null); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/new"); assertThat(paths.get(1)).isNull(); paths.clear(); paths.add("/hotels/*"); paths.add("/hotels/new"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/new"); assertThat(paths.get(1)).isEqualTo("/hotels/*"); paths.clear(); paths.add("/hotels/new"); paths.add("/hotels/*"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/new"); assertThat(paths.get(1)).isEqualTo("/hotels/*"); paths.clear(); paths.add("/hotels/**"); paths.add("/hotels/*"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/*"); assertThat(paths.get(1)).isEqualTo("/hotels/**"); paths.clear(); paths.add("/hotels/*"); paths.add("/hotels/**"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/*"); assertThat(paths.get(1)).isEqualTo("/hotels/**"); paths.clear(); paths.add("/hotels/{hotel}"); paths.add("/hotels/new"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/new"); assertThat(paths.get(1)).isEqualTo("/hotels/{hotel}"); paths.clear(); paths.add("/hotels/new"); paths.add("/hotels/{hotel}"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/new"); assertThat(paths.get(1)).isEqualTo("/hotels/{hotel}"); paths.clear(); @@ -567,7 +567,7 @@ class AntPathMatcherTests { paths.add("/hotels/*"); paths.add("/hotels/{hotel}"); paths.add("/hotels/new"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/new"); assertThat(paths.get(1)).isEqualTo("/hotels/{hotel}"); assertThat(paths.get(2)).isEqualTo("/hotels/*"); @@ -576,7 +576,7 @@ class AntPathMatcherTests { paths.add("/hotels/ne*"); paths.add("/hotels/n*"); Collections.shuffle(paths); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/ne*"); assertThat(paths.get(1)).isEqualTo("/hotels/n*"); paths.clear(); @@ -585,7 +585,7 @@ class AntPathMatcherTests { paths.add("/hotels/new.*"); paths.add("/hotels/{hotel}"); Collections.shuffle(paths); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/hotels/new.*"); assertThat(paths.get(1)).isEqualTo("/hotels/{hotel}"); paths.clear(); @@ -593,7 +593,7 @@ class AntPathMatcherTests { comparator = pathMatcher.getPatternComparator("/web/endUser/action/login.html"); paths.add("/**/login.*"); paths.add("/**/endUser/action/login.*"); - Collections.sort(paths, comparator); + paths.sort(comparator); assertThat(paths.get(0)).isEqualTo("/**/endUser/action/login.*"); assertThat(paths.get(1)).isEqualTo("/**/login.*"); paths.clear();