From cb7e5aa3c0445882a2bc04222573c1563b98117b Mon Sep 17 00:00:00 2001 From: "m.miernik" Date: Tue, 22 Jun 2021 11:37:46 +0200 Subject: Fix sonar issues Replaced methods size() to isEmpty() based on Sonar recommendations Issue-ID: SDNC-1568 Change-Id: I9b2548ba1d42e009a62ddd34f4f43452622c6ff0 Signed-off-by: m.miernik --- .../sdnr/wt/helpserver/data/HelpInfrastructureObject.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sdnr/wt/helpserver/provider') diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java index ebf11b6af..35dbeec9f 100644 --- a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java @@ -72,7 +72,7 @@ public class HelpInfrastructureObject extends JSONObject { public static class NodeObject extends JSONObject { public NodeObject(Path base, File dir, String label, ArrayList versions) { this.put("label", label); - if (versions != null && versions.size() > 0) { + if (versions != null && !versions.isEmpty()) { JSONObject o = new JSONObject(); this.put("versions", o); for (VersionObject version : versions) { @@ -87,7 +87,7 @@ public class HelpInfrastructureObject extends JSONObject { for (File f : list) { if (f.isDirectory()) { ArrayList versions2 = findReadmeVersionFolders(base, f.toPath(), true); - if (versions2 != null && versions2.size() > 0) { + if (versions2 != null && !versions2.isEmpty()) { JSONObject nodes; if (!this.has("nodes")) { this.put("nodes", new JSONObject()); @@ -112,7 +112,7 @@ public class HelpInfrastructureObject extends JSONObject { for (File f : list) { if (f.isDirectory()) { ArrayList versions = findReadmeVersionFolders(root.toPath(), f.toPath(), true); - if (versions != null && versions.size() > 0) { + if (versions != null && !versions.isEmpty()) { NodeObject o = new NodeObject(pRoot, f, f.getName(), versions); this.put(o.getString("label").toLowerCase(), o); } @@ -134,7 +134,7 @@ public class HelpInfrastructureObject extends JSONObject { } Collections.sort(list, VersionObject.getComparer()); Collections.reverse(list); - if (list.size() > 0 && appendCurrent) { + if (!list.isEmpty() && appendCurrent) { list.add(list.get(0).cloneAsCurrent()); } return list; -- cgit 1.2.3-korg