Committed by
Gerrit Code Review
Use diamond operator
Change-Id: Ief0dabe762acb740476eba5eb033dcfce76426b2
Showing
6 changed files
with
17 additions
and
19 deletions
... | @@ -279,8 +279,7 @@ public class DeviceConfiguration implements DeviceProperties { | ... | @@ -279,8 +279,7 @@ public class DeviceConfiguration implements DeviceProperties { |
279 | log.debug("getSubnetGatewayIps for device{} is {}", | 279 | log.debug("getSubnetGatewayIps for device{} is {}", |
280 | deviceId, | 280 | deviceId, |
281 | deviceConfigMap.get(deviceId).gatewayIps.values()); | 281 | deviceConfigMap.get(deviceId).gatewayIps.values()); |
282 | - return new ArrayList<Ip4Address>(deviceConfigMap. | 282 | + return new ArrayList<>(deviceConfigMap.get(deviceId).gatewayIps.values()); |
283 | - get(deviceId).gatewayIps.values()); | ||
284 | } else { | 283 | } else { |
285 | return null; | 284 | return null; |
286 | } | 285 | } |
... | @@ -297,8 +296,7 @@ public class DeviceConfiguration implements DeviceProperties { | ... | @@ -297,8 +296,7 @@ public class DeviceConfiguration implements DeviceProperties { |
297 | log.debug("getSubnets for device{} is {}", | 296 | log.debug("getSubnets for device{} is {}", |
298 | deviceId, | 297 | deviceId, |
299 | deviceConfigMap.get(deviceId).subnets.values()); | 298 | deviceConfigMap.get(deviceId).subnets.values()); |
300 | - return new ArrayList<Ip4Prefix>(deviceConfigMap. | 299 | + return new ArrayList<>(deviceConfigMap.get(deviceId).subnets.values()); |
301 | - get(deviceId).subnets.values()); | ||
302 | } else { | 300 | } else { |
303 | return null; | 301 | return null; |
304 | } | 302 | } | ... | ... |
... | @@ -45,8 +45,8 @@ public class NetworkConfig { | ... | @@ -45,8 +45,8 @@ public class NetworkConfig { |
45 | * Default constructor. | 45 | * Default constructor. |
46 | */ | 46 | */ |
47 | public NetworkConfig() { | 47 | public NetworkConfig() { |
48 | - switches = new ArrayList<SwitchConfig>(); | 48 | + switches = new ArrayList<>(); |
49 | - links = new ArrayList<LinkConfig>(); | 49 | + links = new ArrayList<>(); |
50 | } | 50 | } |
51 | 51 | ||
52 | @JsonProperty("comment") | 52 | @JsonProperty("comment") | ... | ... |
... | @@ -150,7 +150,7 @@ public class NetworkConfigManager implements NetworkConfigService { | ... | @@ -150,7 +150,7 @@ public class NetworkConfigManager implements NetworkConfigService { |
150 | 150 | ||
151 | @Override | 151 | @Override |
152 | public List<SwitchConfig> getConfiguredAllowedSwitches() { | 152 | public List<SwitchConfig> getConfiguredAllowedSwitches() { |
153 | - List<SwitchConfig> allowed = new ArrayList<SwitchConfig>(); | 153 | + List<SwitchConfig> allowed = new ArrayList<>(); |
154 | for (SwitchConfig swc : configuredSwitches.values()) { | 154 | for (SwitchConfig swc : configuredSwitches.values()) { |
155 | if (swc.isAllowed()) { | 155 | if (swc.isAllowed()) { |
156 | allowed.add(swc); | 156 | allowed.add(swc); |
... | @@ -161,7 +161,7 @@ public class NetworkConfigManager implements NetworkConfigService { | ... | @@ -161,7 +161,7 @@ public class NetworkConfigManager implements NetworkConfigService { |
161 | 161 | ||
162 | @Override | 162 | @Override |
163 | public List<LinkConfig> getConfiguredAllowedLinks() { | 163 | public List<LinkConfig> getConfiguredAllowedLinks() { |
164 | - List<LinkConfig> allowed = new ArrayList<LinkConfig>(); | 164 | + List<LinkConfig> allowed = new ArrayList<>(); |
165 | for (LinkConfig lkc : configuredLinks.values()) { | 165 | for (LinkConfig lkc : configuredLinks.values()) { |
166 | if (lkc.isAllowed()) { | 166 | if (lkc.isAllowed()) { |
167 | allowed.add(lkc); | 167 | allowed.add(lkc); |
... | @@ -259,8 +259,8 @@ public class NetworkConfigManager implements NetworkConfigService { | ... | @@ -259,8 +259,8 @@ public class NetworkConfigManager implements NetworkConfigService { |
259 | } | 259 | } |
260 | 260 | ||
261 | private void validateSwitchConfig(List<SwitchConfig> swConfList) { | 261 | private void validateSwitchConfig(List<SwitchConfig> swConfList) { |
262 | - Set<DeviceId> swDpids = new HashSet<DeviceId>(); | 262 | + Set<DeviceId> swDpids = new HashSet<>(); |
263 | - Set<String> swNames = new HashSet<String>(); | 263 | + Set<String> swNames = new HashSet<>(); |
264 | for (SwitchConfig swc : swConfList) { | 264 | for (SwitchConfig swc : swConfList) { |
265 | if (swc.getNodeDpid() == null || swc.getDpid() == null) { | 265 | if (swc.getNodeDpid() == null || swc.getDpid() == null) { |
266 | throw new NetworkConfigException.DpidNotSpecified(swc.getName()); | 266 | throw new NetworkConfigException.DpidNotSpecified(swc.getName()); |
... | @@ -330,9 +330,9 @@ public class NetworkConfigManager implements NetworkConfigService { | ... | @@ -330,9 +330,9 @@ public class NetworkConfigManager implements NetworkConfigService { |
330 | */ | 330 | */ |
331 | public void init() { | 331 | public void init() { |
332 | loadNetworkConfig(); | 332 | loadNetworkConfig(); |
333 | - configuredSwitches = new ConcurrentHashMap<DeviceId, SwitchConfig>(); | 333 | + configuredSwitches = new ConcurrentHashMap<>(); |
334 | - configuredLinks = new ConcurrentHashMap<Link, LinkConfig>(); | 334 | + configuredLinks = new ConcurrentHashMap<>(); |
335 | - nameToDpid = new HashMap<String, DeviceId>(); | 335 | + nameToDpid = new HashMap<>(); |
336 | parseNetworkConfig(); | 336 | parseNetworkConfig(); |
337 | } | 337 | } |
338 | } | 338 | } | ... | ... |
... | @@ -48,7 +48,7 @@ public class PktLinkConfig extends LinkConfig { | ... | @@ -48,7 +48,7 @@ public class PktLinkConfig extends LinkConfig { |
48 | type = lkc.getType(); | 48 | type = lkc.getType(); |
49 | allowed = lkc.isAllowed(); | 49 | allowed = lkc.isAllowed(); |
50 | params = lkc.getParams(); | 50 | params = lkc.getParams(); |
51 | - publishAttributes = new ConcurrentHashMap<String, String>(); | 51 | + publishAttributes = new ConcurrentHashMap<>(); |
52 | parseParams(); | 52 | parseParams(); |
53 | validateParams(); | 53 | validateParams(); |
54 | setPublishAttributes(); | 54 | setPublishAttributes(); | ... | ... |
... | @@ -67,9 +67,9 @@ public class SegmentRouterConfig extends SwitchConfig { | ... | @@ -67,9 +67,9 @@ public class SegmentRouterConfig extends SwitchConfig { |
67 | this.setLongitude(swc.getLongitude()); | 67 | this.setLongitude(swc.getLongitude()); |
68 | this.setParams(swc.getParams()); | 68 | this.setParams(swc.getParams()); |
69 | this.setAllowed(swc.isAllowed()); | 69 | this.setAllowed(swc.isAllowed()); |
70 | - publishAttributes = new ConcurrentHashMap<String, String>(); | 70 | + publishAttributes = new ConcurrentHashMap<>(); |
71 | - adjacencySids = new ArrayList<AdjacencySid>(); | 71 | + adjacencySids = new ArrayList<>(); |
72 | - subnets = new ArrayList<Subnet>(); | 72 | + subnets = new ArrayList<>(); |
73 | parseParams(); | 73 | parseParams(); |
74 | validateParams(); | 74 | validateParams(); |
75 | setPublishAttributes(); | 75 | setPublishAttributes(); |
... | @@ -282,7 +282,7 @@ public class SegmentRouterConfig extends SwitchConfig { | ... | @@ -282,7 +282,7 @@ public class SegmentRouterConfig extends SwitchConfig { |
282 | } else if (fe.getKey().equals("ports")) { | 282 | } else if (fe.getKey().equals("ports")) { |
283 | if (fe.getValue().isArray()) { | 283 | if (fe.getValue().isArray()) { |
284 | Iterator<JsonNode> i = fe.getValue().elements(); | 284 | Iterator<JsonNode> i = fe.getValue().elements(); |
285 | - ports = new ArrayList<Integer>(); | 285 | + ports = new ArrayList<>(); |
286 | while (i.hasNext()) { | 286 | while (i.hasNext()) { |
287 | ports.add(i.next().asInt()); | 287 | ports.add(i.next().asInt()); |
288 | } | 288 | } | ... | ... |
... | @@ -28,7 +28,7 @@ public class MetricNameCompleter extends AbstractChoicesCompleter { | ... | @@ -28,7 +28,7 @@ public class MetricNameCompleter extends AbstractChoicesCompleter { |
28 | @Override | 28 | @Override |
29 | protected List<String> choices() { | 29 | protected List<String> choices() { |
30 | MetricsService metricsService = AbstractShellCommand.get(MetricsService.class); | 30 | MetricsService metricsService = AbstractShellCommand.get(MetricsService.class); |
31 | - return new ArrayList<String>(metricsService.getMetrics().keySet()); | 31 | + return new ArrayList<>(metricsService.getMetrics().keySet()); |
32 | } | 32 | } |
33 | 33 | ||
34 | } | 34 | } | ... | ... |
-
Please register or login to post a comment