Sho SHIMIZU
Committed by Gerrit Code Review

Use diamond operator

Change-Id: Ief0dabe762acb740476eba5eb033dcfce76426b2
......@@ -279,8 +279,7 @@ public class DeviceConfiguration implements DeviceProperties {
log.debug("getSubnetGatewayIps for device{} is {}",
deviceId,
deviceConfigMap.get(deviceId).gatewayIps.values());
return new ArrayList<Ip4Address>(deviceConfigMap.
get(deviceId).gatewayIps.values());
return new ArrayList<>(deviceConfigMap.get(deviceId).gatewayIps.values());
} else {
return null;
}
......@@ -297,8 +296,7 @@ public class DeviceConfiguration implements DeviceProperties {
log.debug("getSubnets for device{} is {}",
deviceId,
deviceConfigMap.get(deviceId).subnets.values());
return new ArrayList<Ip4Prefix>(deviceConfigMap.
get(deviceId).subnets.values());
return new ArrayList<>(deviceConfigMap.get(deviceId).subnets.values());
} else {
return null;
}
......
......@@ -45,8 +45,8 @@ public class NetworkConfig {
* Default constructor.
*/
public NetworkConfig() {
switches = new ArrayList<SwitchConfig>();
links = new ArrayList<LinkConfig>();
switches = new ArrayList<>();
links = new ArrayList<>();
}
@JsonProperty("comment")
......
......@@ -150,7 +150,7 @@ public class NetworkConfigManager implements NetworkConfigService {
@Override
public List<SwitchConfig> getConfiguredAllowedSwitches() {
List<SwitchConfig> allowed = new ArrayList<SwitchConfig>();
List<SwitchConfig> allowed = new ArrayList<>();
for (SwitchConfig swc : configuredSwitches.values()) {
if (swc.isAllowed()) {
allowed.add(swc);
......@@ -161,7 +161,7 @@ public class NetworkConfigManager implements NetworkConfigService {
@Override
public List<LinkConfig> getConfiguredAllowedLinks() {
List<LinkConfig> allowed = new ArrayList<LinkConfig>();
List<LinkConfig> allowed = new ArrayList<>();
for (LinkConfig lkc : configuredLinks.values()) {
if (lkc.isAllowed()) {
allowed.add(lkc);
......@@ -259,8 +259,8 @@ public class NetworkConfigManager implements NetworkConfigService {
}
private void validateSwitchConfig(List<SwitchConfig> swConfList) {
Set<DeviceId> swDpids = new HashSet<DeviceId>();
Set<String> swNames = new HashSet<String>();
Set<DeviceId> swDpids = new HashSet<>();
Set<String> swNames = new HashSet<>();
for (SwitchConfig swc : swConfList) {
if (swc.getNodeDpid() == null || swc.getDpid() == null) {
throw new NetworkConfigException.DpidNotSpecified(swc.getName());
......@@ -330,9 +330,9 @@ public class NetworkConfigManager implements NetworkConfigService {
*/
public void init() {
loadNetworkConfig();
configuredSwitches = new ConcurrentHashMap<DeviceId, SwitchConfig>();
configuredLinks = new ConcurrentHashMap<Link, LinkConfig>();
nameToDpid = new HashMap<String, DeviceId>();
configuredSwitches = new ConcurrentHashMap<>();
configuredLinks = new ConcurrentHashMap<>();
nameToDpid = new HashMap<>();
parseNetworkConfig();
}
}
......
......@@ -48,7 +48,7 @@ public class PktLinkConfig extends LinkConfig {
type = lkc.getType();
allowed = lkc.isAllowed();
params = lkc.getParams();
publishAttributes = new ConcurrentHashMap<String, String>();
publishAttributes = new ConcurrentHashMap<>();
parseParams();
validateParams();
setPublishAttributes();
......
......@@ -67,9 +67,9 @@ public class SegmentRouterConfig extends SwitchConfig {
this.setLongitude(swc.getLongitude());
this.setParams(swc.getParams());
this.setAllowed(swc.isAllowed());
publishAttributes = new ConcurrentHashMap<String, String>();
adjacencySids = new ArrayList<AdjacencySid>();
subnets = new ArrayList<Subnet>();
publishAttributes = new ConcurrentHashMap<>();
adjacencySids = new ArrayList<>();
subnets = new ArrayList<>();
parseParams();
validateParams();
setPublishAttributes();
......@@ -282,7 +282,7 @@ public class SegmentRouterConfig extends SwitchConfig {
} else if (fe.getKey().equals("ports")) {
if (fe.getValue().isArray()) {
Iterator<JsonNode> i = fe.getValue().elements();
ports = new ArrayList<Integer>();
ports = new ArrayList<>();
while (i.hasNext()) {
ports.add(i.next().asInt());
}
......
......@@ -28,7 +28,7 @@ public class MetricNameCompleter extends AbstractChoicesCompleter {
@Override
protected List<String> choices() {
MetricsService metricsService = AbstractShellCommand.get(MetricsService.class);
return new ArrayList<String>(metricsService.getMetrics().keySet());
return new ArrayList<>(metricsService.getMetrics().keySet());
}
}
......