Polish
This commit is contained in:
parent
e2febbdd8c
commit
cca78e42f1
|
|
@ -420,6 +420,7 @@ public abstract class AbstractMethodMessageHandler<T>
|
|||
* <p>If there are no matching prefixes, return {@code null}.
|
||||
* <p>If there are no destination prefixes, return the destination as is.
|
||||
*/
|
||||
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||
@Nullable
|
||||
protected String getLookupDestination(@Nullable String destination) {
|
||||
if (destination == null) {
|
||||
|
|
@ -428,8 +429,7 @@ public abstract class AbstractMethodMessageHandler<T>
|
|||
if (CollectionUtils.isEmpty(this.destinationPrefixes)) {
|
||||
return destination;
|
||||
}
|
||||
// Avoid unnecessary iterator allocation
|
||||
for (int i = 0, size = this.destinationPrefixes.size(); i < size; i++) {
|
||||
for (int i = 0; i < this.destinationPrefixes.size(); i++) {
|
||||
String prefix = this.destinationPrefixes.get(i);
|
||||
if (destination.startsWith(prefix)) {
|
||||
return destination.substring(prefix.length());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* 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.
|
||||
|
|
@ -81,10 +82,10 @@ public class HandlerMethodReturnValueHandlerComposite implements AsyncHandlerMet
|
|||
return getReturnValueHandler(returnType) != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||
@Nullable
|
||||
private HandlerMethodReturnValueHandler getReturnValueHandler(MethodParameter returnType) {
|
||||
// Avoid allocating an iterator
|
||||
for (int i = 0, size = this.returnValueHandlers.size(); i < size; i++) {
|
||||
for (int i = 0; i < this.returnValueHandlers.size(); i++) {
|
||||
HandlerMethodReturnValueHandler handler = this.returnValueHandlers.get(i);
|
||||
if (handler.supportsReturnType(returnType)) {
|
||||
return handler;
|
||||
|
|
|
|||
Loading…
Reference in New Issue