Sonar fixes
Rule: Use isEmpty() to check whether the collection is empty or not.
Change-Id: Ib5ab56b2263623b297db56c5cac2c2ee80e12725
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
index a9582ab..9b8a2e7 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
@@ -209,7 +209,7 @@
Annotations... annotations) {
Collection<Tunnel> tunnels = store.borrowTunnel(consumerId, src,
dst, annotations);
- if (tunnels == null || tunnels.size() == 0) {
+ if (tunnels == null || tunnels.isEmpty()) {
Tunnel tunnel = new DefaultTunnel(null, src, dst, null, null, null,
null, null, annotations);
Set<ProviderId> ids = getProviders();
@@ -228,7 +228,7 @@
Collection<Tunnel> tunnels = store.borrowTunnel(consumerId, src,
dst, type,
annotations);
- if (tunnels == null || tunnels.size() == 0) {
+ if (tunnels == null || tunnels.isEmpty()) {
Tunnel tunnel = new DefaultTunnel(null, src, dst, type, null, null,
null, null, annotations);
Set<ProviderId> ids = getProviders();
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkFlowRuleManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkFlowRuleManager.java
index 31c1415..f6c6e2b 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkFlowRuleManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkFlowRuleManager.java
@@ -251,7 +251,7 @@
@Override
public synchronized void run() {
- if (stages.size() > 0) {
+ if (!stages.isEmpty()) {
process(stages.remove(0));
} else if (!hasFailed) {
fops.callback().onSuccess(fops);
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
index 31452ac..0907643 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
@@ -307,7 +307,7 @@
orderRelationship.put(appId, orderSet);
TunnelKey key = TunnelKey.tunnelKey(src, dst);
Set<TunnelId> idSet = srcAndDstKeyMap.get(key);
- if (idSet == null || idSet.size() == 0) {
+ if (idSet == null || idSet.isEmpty()) {
return Collections.emptySet();
}
Collection<Tunnel> tunnelSet = new HashSet<Tunnel>();
@@ -337,7 +337,7 @@
orderRelationship.put(appId, orderSet);
TunnelKey key = TunnelKey.tunnelKey(src, dst);
Set<TunnelId> idSet = srcAndDstKeyMap.get(key);
- if (idSet == null || idSet.size() == 0) {
+ if (idSet == null || idSet.isEmpty()) {
return Collections.emptySet();
}
Collection<Tunnel> tunnelSet = new HashSet<Tunnel>();
@@ -364,7 +364,7 @@
boolean isExist = orderSet.contains(order);
Set<TunnelId> idSet = tunnelNameAsKeyMap.get(tunnelName);
- if (idSet == null || idSet.size() == 0) {
+ if (idSet == null || idSet.isEmpty()) {
return Collections.emptySet();
}
Collection<Tunnel> tunnelSet = new HashSet<Tunnel>();
@@ -447,7 +447,7 @@
for (TunnelId id : tunnelIds) {
result.add(tunnelIdAsKeyStore.get(id));
}
- return result.size() == 0 ? Collections.emptySet() : ImmutableSet
+ return result.isEmpty() ? Collections.emptySet() : ImmutableSet
.copyOf(result);
}
@@ -462,7 +462,7 @@
for (TunnelId id : tunnelIds) {
result.add(tunnelIdAsKeyStore.get(id));
}
- return result.size() == 0 ? Collections.emptySet() : ImmutableSet
+ return result.isEmpty() ? Collections.emptySet() : ImmutableSet
.copyOf(result);
}