Use diamond operator
Change-Id: Ief0dabe762acb740476eba5eb033dcfce76426b2
diff --git a/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java b/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java
index 9a6e127..ef9d444 100644
--- a/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java
+++ b/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java
@@ -279,8 +279,7 @@
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 @@
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;
}
diff --git a/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java b/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java
index 7f0803f..0c7749e 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java
@@ -45,8 +45,8 @@
* Default constructor.
*/
public NetworkConfig() {
- switches = new ArrayList<SwitchConfig>();
- links = new ArrayList<LinkConfig>();
+ switches = new ArrayList<>();
+ links = new ArrayList<>();
}
@JsonProperty("comment")
diff --git a/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java b/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java
index 0133f6f..f034f37 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java
@@ -150,7 +150,7 @@
@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 @@
@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 @@
}
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 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();
}
}
diff --git a/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java b/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java
index d5a942c..3c51fa9 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java
@@ -48,7 +48,7 @@
type = lkc.getType();
allowed = lkc.isAllowed();
params = lkc.getParams();
- publishAttributes = new ConcurrentHashMap<String, String>();
+ publishAttributes = new ConcurrentHashMap<>();
parseParams();
validateParams();
setPublishAttributes();
diff --git a/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java b/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java
index dd5c4d6..c8d4a54 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java
@@ -67,9 +67,9 @@
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 @@
} 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());
}