Replaced Collection.size() > 0 through !Collection.isEmpty()

This commit is contained in:
Patrick Gotthard 2014-04-13 20:29:39 +02:00
parent 489c1f4b5c
commit e63c849766
7 changed files with 8 additions and 8 deletions

View file

@ -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()]));
}

View file

@ -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]));
}

View file

@ -103,7 +103,7 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene
final List<ContentItem> 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);

View file

@ -81,7 +81,7 @@ public class ContentModuleParser implements com.sun.syndication.io.ModuleParser
final ArrayList<String> contentStrings = new ArrayList<String>();
final ArrayList<String> encodedStrings = new ArrayList<String>();
if (encodeds.size() > 0) {
if (!encodeds.isEmpty()) {
foundSomething = true;
for (int i = 0; i < encodeds.size(); i++) {

View file

@ -89,7 +89,7 @@ public class OpenSearchModuleParser implements ModuleParser {
final List<Element> queries = dcRoot.getChildren("Query", OS_NS);
if (queries != null && queries.size() > 0) {
if (queries != null && !queries.isEmpty()) {
// Create the OSQuery list
final List<OSQuery> osqList = new LinkedList<OSQuery>();

View file

@ -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);
}
}

View file

@ -172,7 +172,7 @@ public class SSE091Parser implements DelegatingModuleParser {
private Element getFirstContent(final Element element, final String name) {
final List<Element> 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;