Avoid unnecessary generics on emptyMap/Set/List
This commit is contained in:
@@ -50,13 +50,10 @@ public abstract class Conventions {
|
||||
* when searching for the 'primary' interface of a proxy.
|
||||
*/
|
||||
private static final Set<Class<?>> IGNORED_INTERFACES;
|
||||
|
||||
static {
|
||||
IGNORED_INTERFACES = Collections.unmodifiableSet(
|
||||
new HashSet<>(Arrays.<Class<?>>asList(
|
||||
Serializable.class,
|
||||
Externalizable.class,
|
||||
Cloneable.class,
|
||||
Comparable.class)));
|
||||
IGNORED_INTERFACES = Collections.unmodifiableSet(new HashSet<>(
|
||||
Arrays.asList(Serializable.class, Externalizable.class, Cloneable.class, Comparable.class)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class JOptCommandLinePropertySource extends CommandLinePropertySource<Opt
|
||||
stringArgValues.add(argValue instanceof String ? (String) argValue : argValue.toString());
|
||||
}
|
||||
if (stringArgValues.isEmpty()) {
|
||||
return (this.source.has(name) ? Collections.<String>emptyList() : null);
|
||||
return (this.source.has(name) ? Collections.emptyList() : null);
|
||||
}
|
||||
return Collections.unmodifiableList(stringArgValues);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class JOptCommandLinePropertySource extends CommandLinePropertySource<Opt
|
||||
Assert.isInstanceOf(String.class, argValue, "Argument values must be of type String");
|
||||
stringArgValues.add((String) argValue);
|
||||
}
|
||||
return (stringArgValues.isEmpty() ? Collections.<String>emptyList() :
|
||||
return (stringArgValues.isEmpty() ? Collections.emptyList() :
|
||||
Collections.unmodifiableList(stringArgValues));
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -54,8 +54,8 @@ public class InstanceFilter<T> {
|
||||
public InstanceFilter(Collection<? extends T> includes,
|
||||
Collection<? extends T> excludes, boolean matchIfEmpty) {
|
||||
|
||||
this.includes = includes != null ? includes : Collections.<T>emptyList();
|
||||
this.excludes = excludes != null ? excludes : Collections.<T>emptyList();
|
||||
this.includes = (includes != null ? includes : Collections.emptyList());
|
||||
this.excludes = (excludes != null ? excludes : Collections.emptyList());
|
||||
this.matchIfEmpty = matchIfEmpty;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class InstanceFilter<T> {
|
||||
* Determine if the specified {code instance} matches this filter.
|
||||
*/
|
||||
public boolean match(T instance) {
|
||||
Assert.notNull(instance, "The instance to match is mandatory");
|
||||
Assert.notNull(instance, "Instance to match must not be null");
|
||||
|
||||
boolean includesSet = !this.includes.isEmpty();
|
||||
boolean excludesSet = !this.excludes.isEmpty();
|
||||
@@ -74,11 +74,9 @@ public class InstanceFilter<T> {
|
||||
|
||||
boolean matchIncludes = match(instance, this.includes);
|
||||
boolean matchExcludes = match(instance, this.excludes);
|
||||
|
||||
if (!includesSet) {
|
||||
return !matchExcludes;
|
||||
}
|
||||
|
||||
if (!excludesSet) {
|
||||
return matchIncludes;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
* @throws IllegalArgumentException if any of the parameters contains illegal characters
|
||||
*/
|
||||
public MimeType(String type, String subtype) {
|
||||
this(type, subtype, Collections.<String, String>emptyMap());
|
||||
this(type, subtype, Collections.emptyMap());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,7 +87,7 @@ public class SimpleNamespaceContext implements NamespaceContext {
|
||||
}
|
||||
else {
|
||||
Set<String> prefixes = this.namespaceUriToPrefixes.get(namespaceUri);
|
||||
return (prefixes != null ? Collections.unmodifiableSet(prefixes) : Collections.<String>emptySet());
|
||||
return (prefixes != null ? Collections.unmodifiableSet(prefixes) : Collections.emptySet());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user