From e63c849766a312c2453478086ed343b160b8c7f7 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Sun, 13 Apr 2014 20:29:39 +0200 Subject: [PATCH] Replaced Collection.size() > 0 through !Collection.isEmpty() --- .../org/rometools/feed/module/cc/io/ModuleParserRSS1.java | 2 +- .../org/rometools/feed/module/cc/io/ModuleParserRSS2.java | 4 ++-- .../feed/module/content/io/ContentModuleGenerator.java | 2 +- .../rometools/feed/module/content/io/ContentModuleParser.java | 2 +- .../feed/module/opensearch/impl/OpenSearchModuleParser.java | 2 +- .../org/rometools/feed/module/sle/io/ModuleGenerator.java | 2 +- src/main/java/org/rometools/feed/module/sse/SSE091Parser.java | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java b/src/main/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java index 67ce2da..6060770 100644 --- a/src/main/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java +++ b/src/main/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java @@ -120,7 +120,7 @@ public class ModuleParserRSS1 implements ModuleParser { licenses.add(License.findByValue(licenseTag.getAttributeValue("resource", RDF))); } - if (licenses.size() > 0) { + if (!licenses.isEmpty()) { module.setLicenses(licenses.toArray(new License[licenses.size()])); } diff --git a/src/main/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java b/src/main/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java index 6460356..d1ba294 100644 --- a/src/main/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java +++ b/src/main/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java @@ -97,7 +97,7 @@ public class ModuleParserRSS2 implements ModuleParser { licenses.add(license); } } - if (licenses.size() > 0) { + if (!licenses.isEmpty()) { module.setAllLicenses(licenses.toArray(new License[0])); } } @@ -109,7 +109,7 @@ public class ModuleParserRSS2 implements ModuleParser { final Element licenseTag = it.next(); licenses.add(License.findByValue(licenseTag.getTextTrim())); } - if (licenses.size() > 0) { + if (!licenses.isEmpty()) { module.setLicenses(licenses.toArray(new License[0])); } diff --git a/src/main/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java b/src/main/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java index 2d16604..82b4a50 100644 --- a/src/main/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java +++ b/src/main/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java @@ -103,7 +103,7 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene final List contentItems = cm.getContentItems(); - if (contentItems != null && contentItems.size() > 0) { + if (contentItems != null && !contentItems.isEmpty()) { final Element items = new Element("items", CONTENT_NS); final Element bag = new Element("Bag", RDF_NS); items.addContent(bag); diff --git a/src/main/java/org/rometools/feed/module/content/io/ContentModuleParser.java b/src/main/java/org/rometools/feed/module/content/io/ContentModuleParser.java index 4123290..9c374a0 100644 --- a/src/main/java/org/rometools/feed/module/content/io/ContentModuleParser.java +++ b/src/main/java/org/rometools/feed/module/content/io/ContentModuleParser.java @@ -81,7 +81,7 @@ public class ContentModuleParser implements com.sun.syndication.io.ModuleParser final ArrayList contentStrings = new ArrayList(); final ArrayList encodedStrings = new ArrayList(); - if (encodeds.size() > 0) { + if (!encodeds.isEmpty()) { foundSomething = true; for (int i = 0; i < encodeds.size(); i++) { diff --git a/src/main/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java b/src/main/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java index fd04873..1786a02 100644 --- a/src/main/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java +++ b/src/main/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java @@ -89,7 +89,7 @@ public class OpenSearchModuleParser implements ModuleParser { final List queries = dcRoot.getChildren("Query", OS_NS); - if (queries != null && queries.size() > 0) { + if (queries != null && !queries.isEmpty()) { // Create the OSQuery list final List osqList = new LinkedList(); diff --git a/src/main/java/org/rometools/feed/module/sle/io/ModuleGenerator.java b/src/main/java/org/rometools/feed/module/sle/io/ModuleGenerator.java index 0ef1975..bf1176b 100644 --- a/src/main/java/org/rometools/feed/module/sle/io/ModuleGenerator.java +++ b/src/main/java/org/rometools/feed/module/sle/io/ModuleGenerator.java @@ -112,7 +112,7 @@ public class ModuleGenerator implements com.sun.syndication.io.ModuleGenerator { listInfo.addContent(sort); } - if (listInfo.getChildren().size() > 0) { + if (!listInfo.getChildren().isEmpty()) { element.addContent(listInfo); } } diff --git a/src/main/java/org/rometools/feed/module/sse/SSE091Parser.java b/src/main/java/org/rometools/feed/module/sse/SSE091Parser.java index f0ff7d0..f0c1b34 100644 --- a/src/main/java/org/rometools/feed/module/sse/SSE091Parser.java +++ b/src/main/java/org/rometools/feed/module/sse/SSE091Parser.java @@ -172,7 +172,7 @@ public class SSE091Parser implements DelegatingModuleParser { private Element getFirstContent(final Element element, final String name) { final List filterList = element.getContent(new ContentFilter(name)); Element firstContent = null; - if (filterList != null && filterList.size() > 0) { + if (filterList != null && !filterList.isEmpty()) { firstContent = filterList.get(0); } return firstContent;