Sonar fixes
Rule: Use isEmpty() to check whether the collection is empty or not.
Change-Id: Ib5ab56b2263623b297db56c5cac2c2ee80e12725
diff --git a/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java b/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
index 9e215a9..b691f80 100644
--- a/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
+++ b/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
@@ -559,7 +559,7 @@
}
List<Port> devPorts = srManager.deviceService.getPorts(deviceId);
- if (devPorts == null || devPorts.size() == 0) {
+ if (devPorts == null || devPorts.isEmpty()) {
log.warn("Device {} ports not available. Unable to add MacVlan filters",
deviceId);
return null;
diff --git a/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java b/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
index 7eb6894..2bd9932 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
@@ -357,7 +357,7 @@
.map(IpPrefix::getIp4Prefix)
.collect(Collectors.toSet());
- if (subnets.size() == 0) {
+ if (subnets.isEmpty()) {
log.info(NO_SUBNET, connectPoint);
return null;
} else if (subnets.size() > 1) {
diff --git a/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java b/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
index 52606cf..b76a04c 100644
--- a/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
@@ -655,7 +655,7 @@
log.warn("Neighbor {} is not in the port map yet for dev:{}",
neighborId, deviceId);
return;
- } else if (devicePortMap.get(neighborId).size() == 0) {
+ } else if (devicePortMap.get(neighborId).isEmpty()) {
log.warn("There are no ports for "
+ "the Device {} in the port map yet", neighborId);
return;