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

@@ -73,7 +73,7 @@ public class DestinationPatternsMessageCondition extends AbstractMessageConditio
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, PathMatcher pathMatcher) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 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.
@@ -84,7 +84,7 @@ public abstract class AbstractBrokerMessageHandler
public AbstractBrokerMessageHandler(SubscribableChannel inboundChannel, MessageChannel outboundChannel,
SubscribableChannel brokerChannel) {
this(inboundChannel, outboundChannel, brokerChannel, Collections.<String>emptyList());
this(inboundChannel, outboundChannel, brokerChannel, Collections.emptyList());
}
/**
@@ -105,7 +105,7 @@ public abstract class AbstractBrokerMessageHandler
this.clientOutboundChannel = outboundChannel;
this.brokerChannel = brokerChannel;
destinationPrefixes = (destinationPrefixes != null) ? destinationPrefixes : Collections.<String>emptyList();
destinationPrefixes = (destinationPrefixes != null) ? destinationPrefixes : Collections.emptyList();
this.destinationPrefixes = Collections.unmodifiableCollection(destinationPrefixes);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@@ -50,8 +50,8 @@ public abstract class AbstractBrokerRegistration {
this.clientInboundChannel = clientInboundChannel;
this.clientOutboundChannel = clientOutboundChannel;
this.destinationPrefixes = (destinationPrefixes != null)
? Arrays.<String>asList(destinationPrefixes) : Collections.<String>emptyList();
this.destinationPrefixes = (destinationPrefixes != null ?
Arrays.asList(destinationPrefixes) : Collections.emptyList());
}
@@ -67,6 +67,7 @@ public abstract class AbstractBrokerRegistration {
return this.destinationPrefixes;
}
protected abstract AbstractBrokerMessageHandler getMessageHandler(SubscribableChannel brokerChannel);
}

View File

@@ -182,7 +182,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
Map<String, List<String>> getNativeHeaders() {
@SuppressWarnings("unchecked")
Map<String, List<String>> map = (Map<String, List<String>>) getHeader(NATIVE_HEADERS);
return (map != null ? map : Collections.<String, List<String>>emptyMap());
return (map != null ? map : Collections.emptyMap());
}
public StompCommand updateStompCommandAsClientMessage() {
@@ -242,7 +242,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
public Set<String> getAcceptVersion() {
String rawValue = getFirstNativeHeader(STOMP_ACCEPT_VERSION_HEADER);
return (rawValue != null ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.<String>emptySet());
return (rawValue != null ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.emptySet());
}
public void setHost(String host) {

View File

@@ -188,7 +188,7 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
}
}
else {
sessionIds = Collections.<String>emptySet();
sessionIds = Collections.emptySet();
}
}
if (!this.keepLeadingSlash) {

View File

@@ -94,7 +94,7 @@ public class NativeMessageHeaderAccessor extends MessageHeaderAccessor {
*/
public Map<String, List<String>> toNativeHeaderMap() {
Map<String, List<String>> map = getNativeHeaders();
return (map != null ? new LinkedMultiValueMap<>(map) : Collections.<String, List<String>>emptyMap());
return (map != null ? new LinkedMultiValueMap<>(map) : Collections.emptyMap());
}
@Override

View File

@@ -299,8 +299,7 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
@Override
public ReactorConfiguration read() {
return new ReactorConfiguration(
Collections.<DispatcherConfiguration>emptyList(), "sync", new Properties());
return new ReactorConfiguration(Collections.emptyList(), "sync", new Properties());
}
}