Avoid unnecessary generics on emptyMap/Set/List

This commit is contained in:
Juergen Hoeller
2016-09-26 18:04:49 +02:00
parent a6b0b6e279
commit fb7ae010c8
35 changed files with 69 additions and 73 deletions

View File

@@ -590,7 +590,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
private void addMappingName(String name, HandlerMethod handlerMethod) {
List<HandlerMethod> oldList = this.nameLookup.get(name);
if (oldList == null) {
oldList = Collections.<HandlerMethod>emptyList();
oldList = Collections.emptyList();
}
for (HandlerMethod current : oldList) {
@@ -685,7 +685,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
Assert.notNull(handlerMethod);
this.mapping = mapping;
this.handlerMethod = handlerMethod;
this.directUrls = (directUrls != null ? directUrls : Collections.<String>emptyList());
this.directUrls = (directUrls != null ? directUrls : Collections.emptyList());
this.mappingName = mappingName;
}

View File

@@ -163,7 +163,7 @@ public class SimpleServletPostProcessor implements
@Override
public Enumeration<String> getInitParameterNames() {
return Collections.enumeration(Collections.<String>emptySet());
return Collections.enumeration(Collections.emptySet());
}
}

View File

@@ -119,7 +119,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
private static List<String> asList(String... patterns) {
return (patterns != null ? Arrays.asList(patterns) : Collections.<String>emptyList());
return (patterns != null ? Arrays.asList(patterns) : Collections.emptyList());
}
private static Set<String> prependLeadingSlash(Collection<String> patterns) {

View File

@@ -62,7 +62,7 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
private static List<RequestMethod> asList(RequestMethod... requestMethods) {
return (requestMethods != null ? Arrays.asList(requestMethods) : Collections.<RequestMethod>emptyList());
return (requestMethods != null ? Arrays.asList(requestMethods) : Collections.emptyList());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -106,7 +106,7 @@ public class ServletModelAttributeMethodProcessor extends ModelAttributeMethodPr
protected final Map<String, String> getUriTemplateVariables(NativeWebRequest request) {
Map<String, String> variables = (Map<String, String>) request.getAttribute(
HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST);
return (variables != null ? variables : Collections.<String, String>emptyMap());
return (variables != null ? variables : Collections.emptyMap());
}
/**

View File

@@ -235,7 +235,7 @@ public class SseEmitter extends ResponseBodyEmitter {
@Override
public Set<DataWithMediaType> build() {
if ((this.sb == null || this.sb.length() == 0) && this.dataToSend.isEmpty()) {
return Collections.<DataWithMediaType>emptySet();
return Collections.emptySet();
}
append("\n");
saveAppendedText();

View File

@@ -405,7 +405,7 @@ public class FreeMarkerView extends AbstractTemplateView {
@Override
public Enumeration<String> getInitParameterNames() {
return Collections.enumeration(Collections.<String>emptySet());
return Collections.enumeration(Collections.emptySet());
}
}