From 9091ffdd952ef4aa3378f9dfcebd35f9869a0e40 Mon Sep 17 00:00:00 2001 From: Aravindh Rajagopalan Date: Wed, 30 Jun 2021 11:47:58 +0530 Subject: [PATCH] Refactor: use diamond operator (#1412) --- .../main/java/com/netflix/appinfo/PropertiesInstanceConfig.java | 2 +- .../java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java | 2 +- .../main/java/com/netflix/discovery/converters/Converters.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eureka-client/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java b/eureka-client/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java index 85fdeb0d4..4c73dfdf0 100644 --- a/eureka-client/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java +++ b/eureka-client/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java @@ -211,7 +211,7 @@ public String getASGName() { @Override public Map getMetadataMap() { String metadataNamespace = namespace + INSTANCE_METADATA_PREFIX + "."; - Map metadataMap = new LinkedHashMap(); + Map metadataMap = new LinkedHashMap<>(); Configuration config = (Configuration) configInstance.getBackingConfigurationSource(); String subsetPrefix = metadataNamespace.charAt(metadataNamespace.length() - 1) == '.' ? metadataNamespace.substring(0, metadataNamespace.length() - 1) diff --git a/eureka-client/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java b/eureka-client/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java index 41e73a712..29bbae25f 100644 --- a/eureka-client/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java +++ b/eureka-client/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java @@ -61,7 +61,7 @@ private static AmazonInfo init(AmazonInfoConfig amazonInfoConfig, FallbackAddres // The property to not validate instance ids may be set for // development and in that scenario, populate instance id // and public hostname with the hostname of the machine - Map metadataMap = new HashMap(); + Map metadataMap = new HashMap<>(); metadataMap.put(AmazonInfo.MetaDataKey.instanceId.getName(), fallbackAddressProvider.getFallbackIp()); metadataMap.put(AmazonInfo.MetaDataKey.publicHostname.getName(), fallbackAddressProvider.getFallbackHostname()); info.setMetadata(metadataMap); diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/Converters.java b/eureka-client/src/main/java/com/netflix/discovery/converters/Converters.java index 9133522cb..6cb0ad0b4 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/converters/Converters.java +++ b/eureka-client/src/main/java/com/netflix/discovery/converters/Converters.java @@ -512,7 +512,7 @@ public Name getName() { if (info.getName() == Name.Amazon) { Map metadataMap = (Map) context .convertAnother(info, Map.class); - Map metadataMapInter = new HashMap(metadataMap.size()); + Map metadataMapInter = new HashMap<>(metadataMap.size()); for (Map.Entry entry : metadataMap.entrySet()) { metadataMapInter.put(StringCache.intern(entry.getKey()), StringCache.intern(entry.getValue())); }