Sonar fixes
Rule: Use isEmpty() to check whether the collection is empty or not.
Change-Id: Ib5ab56b2263623b297db56c5cac2c2ee80e12725
diff --git a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
index 767d026..caa317d 100644
--- a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
+++ b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
@@ -720,7 +720,7 @@
// Creates a path that leads through the given devices.
private Path createPath(List<PcepHopNodeDescription> hopList,
PathType pathtype, PathState pathState) {
- if (hopList == null || hopList.size() == 0) {
+ if (hopList == null || hopList.isEmpty()) {
return null;
}
List<Link> links = new ArrayList<>();
@@ -947,7 +947,7 @@
llSubObjects = createPcepPath(path);
}
- if (llSubObjects == null || llSubObjects.size() == 0) {
+ if (llSubObjects == null || llSubObjects.isEmpty()) {
log.error("There is no link information to create tunnel");
return null;
}
@@ -1053,7 +1053,7 @@
LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList = createPcInitiatedLspReqList(tunnel, path,
pc, srpId);
- if (llPcInitiatedLspRequestList == null || llPcInitiatedLspRequestList.size() == 0) {
+ if (llPcInitiatedLspRequestList == null || llPcInitiatedLspRequestList.isEmpty()) {
log.error("Failed to create PcInitiatedLspRequestList");
return;
}
@@ -1735,7 +1735,7 @@
checkNotNull(eroObj);
List<Object> subObjList = new ArrayList<>();
LinkedList<PcepValueType> llSubObj = eroObj.getSubObjects();
- if (0 == llSubObj.size()) {
+ if (llSubObj.isEmpty()) {
log.error("ERO in report message does not have hop information");
return new ArrayList<>();
}