Replace explicit generics with diamond operator

Where possible, explicit generic declarations to use the Java 8 diamond
operator.

See gh-9781
This commit is contained in:
Emanuel Campolo
2017-07-18 11:50:10 -03:00
committed by Phillip Webb
parent eb35fc9fa6
commit 04fdec6f8b
44 changed files with 64 additions and 68 deletions

View File

@@ -42,7 +42,7 @@ final class EnvironmentConverter {
private static final Set<String> SERVLET_ENVIRONMENT_SOURCE_NAMES;
static {
final Set<String> names = new HashSet<String>();
final Set<String> names = new HashSet<>();
names.add(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME);
names.add(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME);
names.add(StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME);
@@ -109,7 +109,7 @@ final class EnvironmentConverter {
}
private void removeAllPropertySources(MutablePropertySources propertySources) {
Set<String> names = new HashSet<String>();
Set<String> names = new HashSet<>();
for (PropertySource<?> propertySource : propertySources) {
names.add(propertySource.getName());
}

View File

@@ -451,7 +451,7 @@ public final class ConfigurationPropertyName
if (name.length() == 0) {
return EMPTY;
}
List<CharSequence> elements = new ArrayList<CharSequence>(10);
List<CharSequence> elements = new ArrayList<>(10);
process(name, '.', (elementValue, start, end, indexed) -> {
if (elementValue.length() > 0) {
if (!indexed) {
@@ -496,7 +496,7 @@ public final class ConfigurationPropertyName
if (name.length() == 0) {
return EMPTY;
}
List<CharSequence> elements = new ArrayList<CharSequence>(10);
List<CharSequence> elements = new ArrayList<>(10);
process(name, separator, (elementValue, start, end, indexed) -> {
elementValue = elementValueProcessor.apply(elementValue);
if (!isIndexed(elementValue)) {

View File

@@ -78,7 +78,7 @@ class OriginTrackedYamlLoader extends YamlProcessor {
}
public Map<String, Object> load() {
final Map<String, Object> result = new LinkedHashMap<String, Object>();
final Map<String, Object> result = new LinkedHashMap<>();
process((properties, map) -> {
result.putAll(getFlattenedMap(map));
});

View File

@@ -91,21 +91,21 @@ public class NarayanaProperties {
/**
* Comma-separated list of orphan filters.
*/
private List<String> xaResourceOrphanFilters = new ArrayList<String>(Arrays.asList(
private List<String> xaResourceOrphanFilters = new ArrayList<>(Arrays.asList(
"com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter",
"com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter"));
/**
* Comma-separated list of recovery modules.
*/
private List<String> recoveryModules = new ArrayList<String>(Arrays.asList(
private List<String> recoveryModules = new ArrayList<>(Arrays.asList(
"com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule",
"com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule"));
/**
* Comma-separated list of expiry scanners.
*/
private List<String> expiryScanners = new ArrayList<String>(Collections.singletonList(
private List<String> expiryScanners = new ArrayList<>(Collections.singletonList(
"com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner"));
public String getLogDir() {

View File

@@ -88,7 +88,7 @@ public class ServerPortInfoApplicationContextInitializer
MutablePropertySources sources = environment.getPropertySources();
PropertySource<?> source = sources.get("server.ports");
if (source == null) {
source = new MapPropertySource("server.ports", new HashMap<String, Object>());
source = new MapPropertySource("server.ports", new HashMap<>());
sources.addFirst(source);
}
((Map<String, Object>) source.getSource()).put(propertyName, port);

View File

@@ -489,7 +489,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
File root = getValidDocumentRoot();
File docBase = getCanonicalDocumentRoot(root);
List<URL> metaInfResourceUrls = getUrlsOfJarsWithMetaInfResources();
List<URL> resourceJarUrls = new ArrayList<URL>();
List<URL> resourceJarUrls = new ArrayList<>();
List<ResourceManager> resourceManagers = new ArrayList<ResourceManager>();
ResourceManager rootResourceManager = docBase.isDirectory()
? new FileResourceManager(docBase, 0) : new JarResourceManager(docBase);

View File

@@ -444,7 +444,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
this.context = new AnnotationConfigApplicationContext();
MutablePropertySources sources = this.context.getEnvironment()
.getPropertySources();
Map<String, Object> source = new LinkedHashMap<String, Object>();
Map<String, Object> source = new LinkedHashMap<>();
source.put("example.one", "foo");
sources.addFirst(new MapPropertySource("test-source", source));
this.context.register(PrototypePropertiesConfig.class);

View File

@@ -154,7 +154,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests {
WebServerFactoryCustomizer<WebServerFactoryOne> one = (f) -> called.add("one");
WebServerFactoryCustomizer<WebServerFactoryTwo> two = (f) -> called.add("two");
WebServerFactoryCustomizer<WebServerFactory> all = (f) -> called.add("all");
Map<String, Object> beans = new LinkedHashMap<String, Object>();
Map<String, Object> beans = new LinkedHashMap<>();
beans.put("one", one);
beans.put("two", two);
beans.put("all", all);