Prefer List.sort(Comparator) over Collections.sort(List, Comparator)
This commit is contained in:
@@ -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.
|
||||
@@ -168,7 +168,7 @@ public class DestinationPatternsMessageCondition
|
||||
return null;
|
||||
}
|
||||
|
||||
Collections.sort(matches, this.pathMatcher.getPatternComparator(destination));
|
||||
matches.sort(this.pathMatcher.getPatternComparator(destination));
|
||||
return new DestinationPatternsMessageCondition(matches, this.pathMatcher);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -18,7 +18,6 @@ package org.springframework.messaging.handler.invocation;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -126,7 +125,7 @@ public abstract class AbstractExceptionHandlerMethodResolver {
|
||||
}
|
||||
}
|
||||
if (!matches.isEmpty()) {
|
||||
Collections.sort(matches, new ExceptionDepthComparator(exceptionType));
|
||||
matches.sort(new ExceptionDepthComparator(exceptionType));
|
||||
return this.mappedMethods.get(matches.get(0));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -453,7 +453,7 @@ public abstract class AbstractMethodMessageHandler<T>
|
||||
return;
|
||||
}
|
||||
Comparator<Match> comparator = new MatchComparator(getMappingComparator(message));
|
||||
Collections.sort(matches, comparator);
|
||||
matches.sort(comparator);
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Found " + matches.size() + " handler methods: " + matches);
|
||||
|
||||
Reference in New Issue
Block a user