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

This commit is contained in:
Patrick Gotthard 2014-04-13 20:29:31 +02:00
parent 3a31c851b6
commit 65b7799c96
19 changed files with 137 additions and 137 deletions

View file

@ -134,7 +134,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getTitle() { public String getTitle() {
if (title != null && title.size() > 0) { if (title != null && !title.isEmpty()) {
return title.get(0); return title.get(0);
} else { } else {
return null; return null;
@ -192,7 +192,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getCreator() { public String getCreator() {
if (creator != null && creator.size() > 0) { if (creator != null && !creator.isEmpty()) {
return creator.get(0); return creator.get(0);
} else { } else {
return null; return null;
@ -251,7 +251,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public DCSubject getSubject() { public DCSubject getSubject() {
if (subject != null && subject.size() > 0) { if (subject != null && !subject.isEmpty()) {
return subject.get(0); return subject.get(0);
} else { } else {
return null; return null;
@ -310,7 +310,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getDescription() { public String getDescription() {
if (description != null && description.size() > 0) { if (description != null && !description.isEmpty()) {
return description.get(0); return description.get(0);
} else { } else {
return null; return null;
@ -369,7 +369,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getPublisher() { public String getPublisher() {
if (publisher != null && publisher.size() > 0) { if (publisher != null && !publisher.isEmpty()) {
return publisher.get(0); return publisher.get(0);
} else { } else {
return null; return null;
@ -428,7 +428,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getContributor() { public String getContributor() {
if (contributors != null && contributors.size() > 0) { if (contributors != null && !contributors.isEmpty()) {
return contributors.get(0); return contributors.get(0);
} else { } else {
return null; return null;
@ -486,7 +486,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public Date getDate() { public Date getDate() {
if (date != null && date.size() > 0) { if (date != null && !date.isEmpty()) {
return date.get(0); return date.get(0);
} else { } else {
return null; return null;
@ -544,7 +544,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getType() { public String getType() {
if (type != null && type.size() > 0) { if (type != null && !type.isEmpty()) {
return type.get(0); return type.get(0);
} else { } else {
return null; return null;
@ -602,7 +602,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getFormat() { public String getFormat() {
if (format != null && format.size() > 0) { if (format != null && !format.isEmpty()) {
return format.get(0); return format.get(0);
} else { } else {
return null; return null;
@ -661,7 +661,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getIdentifier() { public String getIdentifier() {
if (identifier != null && identifier.size() > 0) { if (identifier != null && !identifier.isEmpty()) {
return identifier.get(0); return identifier.get(0);
} else { } else {
return null; return null;
@ -719,7 +719,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getSource() { public String getSource() {
if (source != null && source.size() > 0) { if (source != null && !source.isEmpty()) {
return source.get(0); return source.get(0);
} else { } else {
return null; return null;
@ -777,7 +777,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getLanguage() { public String getLanguage() {
if (language != null && language.size() > 0) { if (language != null && !language.isEmpty()) {
return language.get(0); return language.get(0);
} else { } else {
return null; return null;
@ -835,7 +835,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getRelation() { public String getRelation() {
if (relation != null && relation.size() > 0) { if (relation != null && !relation.isEmpty()) {
return relation.get(0); return relation.get(0);
} else { } else {
return null; return null;
@ -893,7 +893,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getCoverage() { public String getCoverage() {
if (coverage != null && coverage.size() > 0) { if (coverage != null && !coverage.isEmpty()) {
return coverage.get(0); return coverage.get(0);
} else { } else {
return null; return null;
@ -951,7 +951,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
*/ */
@Override @Override
public String getRights() { public String getRights() {
if (rights != null && rights.size() > 0) { if (rights != null && !rights.isEmpty()) {
return rights.get(0); return rights.get(0);
} else { } else {
return null; return null;

View file

@ -594,7 +594,7 @@ public class SyndEntryImpl implements Serializable, SyndEntry {
// Start out looking for one or more authors in authors. For non-Atom // Start out looking for one or more authors in authors. For non-Atom
// feeds, authors may actually be null. // feeds, authors may actually be null.
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
author = authors.get(0).getName(); author = authors.get(0).getName();
} else { } else {
author = getDCModule().getCreator(); author = getDCModule().getCreator();

View file

@ -67,7 +67,7 @@ public class ConverterForAtom03 implements Converter {
syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules())); syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules()));
if (feed.getForeignMarkup().size() > 0) { if (!feed.getForeignMarkup().isEmpty()) {
syndFeed.setForeignMarkup(feed.getForeignMarkup()); syndFeed.setForeignMarkup(feed.getForeignMarkup());
} }
@ -75,11 +75,11 @@ public class ConverterForAtom03 implements Converter {
syndFeed.setStyleSheet(aFeed.getStyleSheet()); syndFeed.setStyleSheet(aFeed.getStyleSheet());
if (aFeed.getLogo() != null) { if (aFeed.getLogo() != null) {
SyndImage image = new SyndImageImpl(); final SyndImage image = new SyndImageImpl();
image.setUrl(aFeed.getLogo()); image.setUrl(aFeed.getLogo());
syndFeed.setImage(image); syndFeed.setImage(image);
} else if (aFeed.getIcon() != null) { } else if (aFeed.getIcon() != null) {
SyndImage image = new SyndImageImpl(); final SyndImage image = new SyndImageImpl();
image.setUrl(aFeed.getIcon()); image.setUrl(aFeed.getIcon());
syndFeed.setImage(image); syndFeed.setImage(image);
} }
@ -89,16 +89,16 @@ public class ConverterForAtom03 implements Converter {
syndFeed.setTitle(aFeed.getTitle()); syndFeed.setTitle(aFeed.getTitle());
// use first alternate links as THE link // use first alternate links as THE link
if (aFeed.getAlternateLinks() != null && aFeed.getAlternateLinks().size() > 0) { if (aFeed.getAlternateLinks() != null && !aFeed.getAlternateLinks().isEmpty()) {
final Link theLink = aFeed.getAlternateLinks().get(0); final Link theLink = aFeed.getAlternateLinks().get(0);
syndFeed.setLink(theLink.getHrefResolved()); syndFeed.setLink(theLink.getHrefResolved());
} }
// lump alternate and other links together // lump alternate and other links together
final List<SyndLink> syndLinks = new ArrayList<SyndLink>(); final List<SyndLink> syndLinks = new ArrayList<SyndLink>();
if (aFeed.getAlternateLinks() != null && aFeed.getAlternateLinks().size() > 0) { if (aFeed.getAlternateLinks() != null && !aFeed.getAlternateLinks().isEmpty()) {
syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks())); syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks()));
} }
if (aFeed.getOtherLinks() != null && aFeed.getOtherLinks().size() > 0) { if (aFeed.getOtherLinks() != null && !aFeed.getOtherLinks().isEmpty()) {
syndLinks.addAll(createSyndLinks(aFeed.getOtherLinks())); syndLinks.addAll(createSyndLinks(aFeed.getOtherLinks()));
} }
syndFeed.setLinks(syndLinks); syndFeed.setLinks(syndLinks);
@ -122,7 +122,7 @@ public class ConverterForAtom03 implements Converter {
} }
final List<SyndPerson> authors = aFeed.getAuthors(); final List<SyndPerson> authors = aFeed.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
syndFeed.setAuthors(createSyndPersons(authors)); syndFeed.setAuthors(createSyndPersons(authors));
} }
@ -175,7 +175,7 @@ public class ConverterForAtom03 implements Converter {
syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules())); syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));
if (entry.getForeignMarkup().size() > 0) { if (!entry.getForeignMarkup().isEmpty()) {
syndEntry.setForeignMarkup(entry.getForeignMarkup()); syndEntry.setForeignMarkup(entry.getForeignMarkup());
} }
@ -189,7 +189,7 @@ public class ConverterForAtom03 implements Converter {
// Create synd enclosures from enclosure links // Create synd enclosures from enclosure links
final List<SyndEnclosure> syndEnclosures = new ArrayList<SyndEnclosure>(); final List<SyndEnclosure> syndEnclosures = new ArrayList<SyndEnclosure>();
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) { if (entry.getOtherLinks() != null && !entry.getOtherLinks().isEmpty()) {
final List<Link> oLinks = entry.getOtherLinks(); final List<Link> oLinks = entry.getOtherLinks();
for (final Link link : oLinks) { for (final Link link : oLinks) {
final Link thisLink = link; final Link thisLink = link;
@ -202,10 +202,10 @@ public class ConverterForAtom03 implements Converter {
// lump alternate and other links together // lump alternate and other links together
final List<SyndLink> syndLinks = new ArrayList<SyndLink>(); final List<SyndLink> syndLinks = new ArrayList<SyndLink>();
if (entry.getAlternateLinks() != null && entry.getAlternateLinks().size() > 0) { if (entry.getAlternateLinks() != null && !entry.getAlternateLinks().isEmpty()) {
syndLinks.addAll(createSyndLinks(entry.getAlternateLinks())); syndLinks.addAll(createSyndLinks(entry.getAlternateLinks()));
} }
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) { if (entry.getOtherLinks() != null && !entry.getOtherLinks().isEmpty()) {
syndLinks.addAll(createSyndLinks(entry.getOtherLinks())); syndLinks.addAll(createSyndLinks(entry.getOtherLinks()));
} }
syndEntry.setLinks(syndLinks); syndEntry.setLinks(syndLinks);
@ -220,7 +220,7 @@ public class ConverterForAtom03 implements Converter {
Content content = entry.getSummary(); Content content = entry.getSummary();
if (content == null) { if (content == null) {
final List<Content> contents = entry.getContents(); final List<Content> contents = entry.getContents();
if (contents != null && contents.size() > 0) { if (contents != null && !contents.isEmpty()) {
content = contents.get(0); content = contents.get(0);
} }
} }
@ -232,7 +232,7 @@ public class ConverterForAtom03 implements Converter {
} }
final List<Content> contents = entry.getContents(); final List<Content> contents = entry.getContents();
if (contents.size() > 0) { if (!contents.isEmpty()) {
final List<SyndContent> sContents = new ArrayList<SyndContent>(); final List<SyndContent> sContents = new ArrayList<SyndContent>();
for (int i = 0; i < contents.size(); i++) { for (int i = 0; i < contents.size(); i++) {
content = contents.get(i); content = contents.get(i);
@ -246,7 +246,7 @@ public class ConverterForAtom03 implements Converter {
} }
final List<SyndPerson> authors = entry.getAuthors(); final List<SyndPerson> authors = entry.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
syndEntry.setAuthors(createSyndPersons(authors)); syndEntry.setAuthors(createSyndPersons(authors));
final SyndPerson person0 = syndEntry.getAuthors().get(0); final SyndPerson person0 = syndEntry.getAuthors().get(0);
syndEntry.setAuthor(person0.getName()); syndEntry.setAuthor(person0.getName());
@ -322,10 +322,10 @@ public class ConverterForAtom03 implements Converter {
alternateLinks.add(link); alternateLinks.add(link);
} }
if (alternateLinks.size() > 0) { if (!alternateLinks.isEmpty()) {
aFeed.setAlternateLinks(alternateLinks); aFeed.setAlternateLinks(alternateLinks);
} }
if (otherLinks.size() > 0) { if (!otherLinks.isEmpty()) {
aFeed.setOtherLinks(otherLinks); aFeed.setOtherLinks(otherLinks);
} }
@ -339,7 +339,7 @@ public class ConverterForAtom03 implements Converter {
aFeed.setLanguage(syndFeed.getLanguage()); aFeed.setLanguage(syndFeed.getLanguage());
final List<SyndPerson> authors = syndFeed.getAuthors(); final List<SyndPerson> authors = syndFeed.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
aFeed.setAuthors(createAtomPersons(authors)); aFeed.setAuthors(createAtomPersons(authors));
} }
@ -443,10 +443,10 @@ public class ConverterForAtom03 implements Converter {
} }
} }
if (alternateLinks.size() > 0) { if (!alternateLinks.isEmpty()) {
aEntry.setAlternateLinks(alternateLinks); aEntry.setAlternateLinks(alternateLinks);
} }
if (otherLinks.size() > 0) { if (!otherLinks.isEmpty()) {
aEntry.setOtherLinks(otherLinks); aEntry.setOtherLinks(otherLinks);
} }
@ -460,7 +460,7 @@ public class ConverterForAtom03 implements Converter {
} }
final List<SyndContent> contents = sEntry.getContents(); final List<SyndContent> contents = sEntry.getContents();
if (contents.size() > 0) { if (!contents.isEmpty()) {
final List<Content> aContents = new ArrayList<Content>(); final List<Content> aContents = new ArrayList<Content>();
for (int i = 0; i < contents.size(); i++) { for (int i = 0; i < contents.size(); i++) {
sContent = contents.get(i); sContent = contents.get(i);
@ -475,7 +475,7 @@ public class ConverterForAtom03 implements Converter {
} }
final List<SyndPerson> sAuthors = sEntry.getAuthors(); final List<SyndPerson> sAuthors = sEntry.getAuthors();
if (sAuthors != null && sAuthors.size() > 0) { if (sAuthors != null && !sAuthors.isEmpty()) {
aEntry.setAuthors(createAtomPersons(sAuthors)); aEntry.setAuthors(createAtomPersons(sAuthors));
} else if (sEntry.getAuthor() != null) { } else if (sEntry.getAuthor() != null) {
final Person person = new Person(); final Person person = new Person();

View file

@ -69,7 +69,7 @@ public class ConverterForAtom10 implements Converter {
syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules())); syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules()));
if (feed.getForeignMarkup().size() > 0) { if (!feed.getForeignMarkup().isEmpty()) {
syndFeed.setForeignMarkup(feed.getForeignMarkup()); syndFeed.setForeignMarkup(feed.getForeignMarkup());
} }
@ -77,11 +77,11 @@ public class ConverterForAtom10 implements Converter {
syndFeed.setStyleSheet(aFeed.getStyleSheet()); syndFeed.setStyleSheet(aFeed.getStyleSheet());
if (aFeed.getLogo() != null) { if (aFeed.getLogo() != null) {
SyndImage image = new SyndImageImpl(); final SyndImage image = new SyndImageImpl();
image.setUrl(aFeed.getLogo()); image.setUrl(aFeed.getLogo());
syndFeed.setImage(image); syndFeed.setImage(image);
} else if (aFeed.getIcon() != null) { } else if (aFeed.getIcon() != null) {
SyndImage image = new SyndImageImpl(); final SyndImage image = new SyndImageImpl();
image.setUrl(aFeed.getIcon()); image.setUrl(aFeed.getIcon());
syndFeed.setImage(image); syndFeed.setImage(image);
} }
@ -105,16 +105,16 @@ public class ConverterForAtom10 implements Converter {
} }
// use first alternate links as THE link // use first alternate links as THE link
if (aFeed.getAlternateLinks() != null && aFeed.getAlternateLinks().size() > 0) { if (aFeed.getAlternateLinks() != null && !aFeed.getAlternateLinks().isEmpty()) {
final Link theLink = aFeed.getAlternateLinks().get(0); final Link theLink = aFeed.getAlternateLinks().get(0);
syndFeed.setLink(theLink.getHrefResolved()); syndFeed.setLink(theLink.getHrefResolved());
} }
// lump alternate and other links together // lump alternate and other links together
final List<SyndLink> syndLinks = new ArrayList<SyndLink>(); final List<SyndLink> syndLinks = new ArrayList<SyndLink>();
if (aFeed.getAlternateLinks() != null && aFeed.getAlternateLinks().size() > 0) { if (aFeed.getAlternateLinks() != null && !aFeed.getAlternateLinks().isEmpty()) {
syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks())); syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks()));
} }
if (aFeed.getOtherLinks() != null && aFeed.getOtherLinks().size() > 0) { if (aFeed.getOtherLinks() != null && !aFeed.getOtherLinks().isEmpty()) {
syndLinks.addAll(createSyndLinks(aFeed.getOtherLinks())); syndLinks.addAll(createSyndLinks(aFeed.getOtherLinks()));
} }
syndFeed.setLinks(syndLinks); syndFeed.setLinks(syndLinks);
@ -128,12 +128,12 @@ public class ConverterForAtom10 implements Converter {
// over DC equivalent info. // over DC equivalent info.
final List<SyndPerson> authors = aFeed.getAuthors(); final List<SyndPerson> authors = aFeed.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
syndFeed.setAuthors(ConverterForAtom03.createSyndPersons(authors)); syndFeed.setAuthors(ConverterForAtom03.createSyndPersons(authors));
} }
final List<SyndPerson> contributors = aFeed.getContributors(); final List<SyndPerson> contributors = aFeed.getContributors();
if (contributors != null && contributors.size() > 0) { if (contributors != null && !contributors.isEmpty()) {
syndFeed.setContributors(ConverterForAtom03.createSyndPersons(contributors)); syndFeed.setContributors(ConverterForAtom03.createSyndPersons(contributors));
} }
@ -174,7 +174,7 @@ public class ConverterForAtom10 implements Converter {
} }
syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules())); syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));
if (entry.getForeignMarkup().size() > 0) { if (!entry.getForeignMarkup().isEmpty()) {
syndEntry.setForeignMarkup(entry.getForeignMarkup()); syndEntry.setForeignMarkup(entry.getForeignMarkup());
} }
@ -189,7 +189,7 @@ public class ConverterForAtom10 implements Converter {
} }
final List<Content> contents = entry.getContents(); final List<Content> contents = entry.getContents();
if (contents != null && contents.size() > 0) { if (contents != null && !contents.isEmpty()) {
final List<SyndContent> sContents = new ArrayList<SyndContent>(); final List<SyndContent> sContents = new ArrayList<SyndContent>();
for (final Content content2 : contents) { for (final Content content2 : contents) {
final Content content = content2; final Content content = content2;
@ -199,14 +199,14 @@ public class ConverterForAtom10 implements Converter {
} }
final List<SyndPerson> authors = entry.getAuthors(); final List<SyndPerson> authors = entry.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
syndEntry.setAuthors(ConverterForAtom03.createSyndPersons(authors)); syndEntry.setAuthors(ConverterForAtom03.createSyndPersons(authors));
final SyndPerson person0 = syndEntry.getAuthors().get(0); final SyndPerson person0 = syndEntry.getAuthors().get(0);
syndEntry.setAuthor(person0.getName()); syndEntry.setAuthor(person0.getName());
} }
final List<SyndPerson> contributors = entry.getContributors(); final List<SyndPerson> contributors = entry.getContributors();
if (contributors != null && contributors.size() > 0) { if (contributors != null && !contributors.isEmpty()) {
syndEntry.setContributors(ConverterForAtom03.createSyndPersons(contributors)); syndEntry.setContributors(ConverterForAtom03.createSyndPersons(contributors));
} }
@ -236,14 +236,14 @@ public class ConverterForAtom10 implements Converter {
} }
// use first alternate link as THE link // use first alternate link as THE link
if (entry.getAlternateLinks() != null && entry.getAlternateLinks().size() > 0) { if (entry.getAlternateLinks() != null && !entry.getAlternateLinks().isEmpty()) {
final Link theLink = entry.getAlternateLinks().get(0); final Link theLink = entry.getAlternateLinks().get(0);
syndEntry.setLink(theLink.getHrefResolved()); syndEntry.setLink(theLink.getHrefResolved());
} }
// Create synd enclosures from enclosure links // Create synd enclosures from enclosure links
final List<SyndEnclosure> syndEnclosures = new ArrayList<SyndEnclosure>(); final List<SyndEnclosure> syndEnclosures = new ArrayList<SyndEnclosure>();
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) { if (entry.getOtherLinks() != null && !entry.getOtherLinks().isEmpty()) {
final List<Link> oLinks = entry.getOtherLinks(); final List<Link> oLinks = entry.getOtherLinks();
for (final Link link : oLinks) { for (final Link link : oLinks) {
final Link thisLink = link; final Link thisLink = link;
@ -256,10 +256,10 @@ public class ConverterForAtom10 implements Converter {
// lump alternate and other links together // lump alternate and other links together
final List<SyndLink> syndLinks = new ArrayList<SyndLink>(); final List<SyndLink> syndLinks = new ArrayList<SyndLink>();
if (entry.getAlternateLinks() != null && entry.getAlternateLinks().size() > 0) { if (entry.getAlternateLinks() != null && !entry.getAlternateLinks().isEmpty()) {
syndLinks.addAll(createSyndLinks(entry.getAlternateLinks())); syndLinks.addAll(createSyndLinks(entry.getAlternateLinks()));
} }
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) { if (entry.getOtherLinks() != null && !entry.getOtherLinks().isEmpty()) {
syndLinks.addAll(createSyndLinks(entry.getOtherLinks())); syndLinks.addAll(createSyndLinks(entry.getOtherLinks()));
} }
syndEntry.setLinks(syndLinks); syndEntry.setLinks(syndLinks);
@ -369,10 +369,10 @@ public class ConverterForAtom10 implements Converter {
link.setHref(syndFeed.getLink()); link.setHref(syndFeed.getLink());
alternateLinks.add(link); alternateLinks.add(link);
} }
if (alternateLinks.size() > 0) { if (!alternateLinks.isEmpty()) {
aFeed.setAlternateLinks(alternateLinks); aFeed.setAlternateLinks(alternateLinks);
} }
if (otherLinks.size() > 0) { if (!otherLinks.isEmpty()) {
aFeed.setOtherLinks(otherLinks); aFeed.setOtherLinks(otherLinks);
} }
@ -388,17 +388,17 @@ public class ConverterForAtom10 implements Converter {
aCats.add(aCat); aCats.add(aCat);
} }
} }
if (aCats.size() > 0) { if (!aCats.isEmpty()) {
aFeed.setCategories(aCats); aFeed.setCategories(aCats);
} }
final List<SyndPerson> authors = syndFeed.getAuthors(); final List<SyndPerson> authors = syndFeed.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
aFeed.setAuthors(ConverterForAtom03.createAtomPersons(authors)); aFeed.setAuthors(ConverterForAtom03.createAtomPersons(authors));
} }
final List<SyndPerson> contributors = syndFeed.getContributors(); final List<SyndPerson> contributors = syndFeed.getContributors();
if (contributors != null && contributors.size() > 0) { if (contributors != null && !contributors.isEmpty()) {
aFeed.setContributors(ConverterForAtom03.createAtomPersons(contributors)); aFeed.setContributors(ConverterForAtom03.createAtomPersons(contributors));
} }
@ -411,7 +411,7 @@ public class ConverterForAtom10 implements Converter {
aFeed.setEntries(createAtomEntries(sEntries)); aFeed.setEntries(createAtomEntries(sEntries));
} }
if (syndFeed.getForeignMarkup().size() > 0) { if (!syndFeed.getForeignMarkup().isEmpty()) {
aFeed.setForeignMarkup(syndFeed.getForeignMarkup()); aFeed.setForeignMarkup(syndFeed.getForeignMarkup());
} }
return aFeed; return aFeed;
@ -508,10 +508,10 @@ public class ConverterForAtom10 implements Converter {
otherLinks.add(link); otherLinks.add(link);
} }
} }
if (alternateLinks.size() > 0) { if (!alternateLinks.isEmpty()) {
aEntry.setAlternateLinks(alternateLinks); aEntry.setAlternateLinks(alternateLinks);
} }
if (otherLinks.size() > 0) { if (!otherLinks.isEmpty()) {
aEntry.setOtherLinks(otherLinks); aEntry.setOtherLinks(otherLinks);
} }
@ -527,7 +527,7 @@ public class ConverterForAtom10 implements Converter {
aCats.add(aCat); aCats.add(aCat);
} }
} }
if (aCats.size() > 0) { if (!aCats.isEmpty()) {
aEntry.setCategories(aCats); aEntry.setCategories(aCats);
} }
@ -535,7 +535,7 @@ public class ConverterForAtom10 implements Converter {
aEntry.setContents(createAtomContents(syndContents)); aEntry.setContents(createAtomContents(syndContents));
List<SyndPerson> authors = sEntry.getAuthors(); List<SyndPerson> authors = sEntry.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
aEntry.setAuthors(ConverterForAtom03.createAtomPersons(authors)); aEntry.setAuthors(ConverterForAtom03.createAtomPersons(authors));
} else if (sEntry.getAuthor() != null) { } else if (sEntry.getAuthor() != null) {
final Person person = new Person(); final Person person = new Person();
@ -546,7 +546,7 @@ public class ConverterForAtom10 implements Converter {
} }
final List<SyndPerson> contributors = sEntry.getContributors(); final List<SyndPerson> contributors = sEntry.getContributors();
if (contributors != null && contributors.size() > 0) { if (contributors != null && !contributors.isEmpty()) {
aEntry.setContributors(ConverterForAtom03.createAtomPersons(contributors)); aEntry.setContributors(ConverterForAtom03.createAtomPersons(contributors));
} }
@ -561,7 +561,7 @@ public class ConverterForAtom10 implements Converter {
aEntry.setUpdated(sEntry.getPublishedDate()); aEntry.setUpdated(sEntry.getPublishedDate());
} }
if (sEntry.getForeignMarkup().size() > 0) { if (!sEntry.getForeignMarkup().isEmpty()) {
aEntry.setForeignMarkup(sEntry.getForeignMarkup()); aEntry.setForeignMarkup(sEntry.getForeignMarkup());
} }

View file

@ -54,7 +54,7 @@ public class ConverterForRSS090 implements Converter {
@Override @Override
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) { public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {
syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules())); syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
if (feed.getForeignMarkup().size() > 0) { if (!feed.getForeignMarkup().isEmpty()) {
syndFeed.setForeignMarkup(feed.getForeignMarkup()); syndFeed.setForeignMarkup(feed.getForeignMarkup());
} }
syndFeed.setStyleSheet(feed.getStyleSheet()); syndFeed.setStyleSheet(feed.getStyleSheet());
@ -99,7 +99,7 @@ public class ConverterForRSS090 implements Converter {
syndEntry.setModules(ModuleUtils.cloneModules(item.getModules())); syndEntry.setModules(ModuleUtils.cloneModules(item.getModules()));
if (item.getForeignMarkup().size() > 0) { if (!item.getForeignMarkup().isEmpty()) {
syndEntry.setForeignMarkup(item.getForeignMarkup()); syndEntry.setForeignMarkup(item.getForeignMarkup());
} }
@ -136,7 +136,7 @@ public class ConverterForRSS090 implements Converter {
channel.setTitle(syndFeed.getTitle()); channel.setTitle(syndFeed.getTitle());
if (syndFeed.getLink() != null) { if (syndFeed.getLink() != null) {
channel.setLink(syndFeed.getLink()); channel.setLink(syndFeed.getLink());
} else if (syndFeed.getLinks().size() > 0) { } else if (!syndFeed.getLinks().isEmpty()) {
channel.setLink(syndFeed.getLinks().get(0).getHref()); channel.setLink(syndFeed.getLinks().get(0).getHref());
} }
channel.setDescription(syndFeed.getDescription()); channel.setDescription(syndFeed.getDescription());
@ -150,7 +150,7 @@ public class ConverterForRSS090 implements Converter {
channel.setItems(createRSSItems(sEntries)); channel.setItems(createRSSItems(sEntries));
} }
if (syndFeed.getForeignMarkup().size() > 0) { if (!syndFeed.getForeignMarkup().isEmpty()) {
channel.setForeignMarkup(syndFeed.getForeignMarkup()); channel.setForeignMarkup(syndFeed.getForeignMarkup());
} }
return channel; return channel;
@ -177,7 +177,7 @@ public class ConverterForRSS090 implements Converter {
item.setModules(ModuleUtils.cloneModules(sEntry.getModules())); item.setModules(ModuleUtils.cloneModules(sEntry.getModules()));
item.setTitle(sEntry.getTitle()); item.setTitle(sEntry.getTitle());
item.setLink(sEntry.getLink()); item.setLink(sEntry.getLink());
if (sEntry.getForeignMarkup().size() > 0) { if (!sEntry.getForeignMarkup().isEmpty()) {
item.setForeignMarkup(sEntry.getForeignMarkup()); item.setForeignMarkup(sEntry.getForeignMarkup());
} }

View file

@ -114,7 +114,7 @@ public class ConverterForRSS091Userland extends ConverterForRSS090 {
final List<SyndContent> contents = sEntry.getContents(); final List<SyndContent> contents = sEntry.getContents();
if (contents != null && contents.size() > 0) { if (contents != null && !contents.isEmpty()) {
final SyndContent syndContent = contents.get(0); final SyndContent syndContent = contents.get(0);
final Content cont = new Content(); final Content cont = new Content();
cont.setValue(syndContent.getValue()); cont.setValue(syndContent.getValue());
@ -136,7 +136,7 @@ public class ConverterForRSS091Userland extends ConverterForRSS090 {
channel.setWebMaster(syndFeed.getWebMaster()); channel.setWebMaster(syndFeed.getWebMaster());
channel.setGenerator(syndFeed.getGenerator()); channel.setGenerator(syndFeed.getGenerator());
if (syndFeed.getAuthors() != null && syndFeed.getAuthors().size() > 0) { if (syndFeed.getAuthors() != null && !syndFeed.getAuthors().isEmpty()) {
final SyndPerson author = syndFeed.getAuthors().get(0); final SyndPerson author = syndFeed.getAuthors().get(0);
channel.setManagingEditor(author.getName()); channel.setManagingEditor(author.getName());
} }

View file

@ -46,7 +46,7 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) { protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {
final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem); final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
final List<Category> cats = item.getCategories(); final List<Category> cats = item.getCategories();
if (cats.size() > 0) { if (!cats.isEmpty()) {
final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>(); // using final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>(); // using
// a // a
// set to // set to
@ -68,7 +68,7 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
syndEntry.setCategories(new ArrayList<SyndCategory>(s)); // c syndEntry.setCategories(new ArrayList<SyndCategory>(s)); // c
} }
final List<Enclosure> enclosures = item.getEnclosures(); final List<Enclosure> enclosures = item.getEnclosures();
if (enclosures.size() > 0) { if (!enclosures.isEmpty()) {
syndEntry.setEnclosures(createSyndEnclosures(enclosures)); syndEntry.setEnclosures(createSyndEnclosures(enclosures));
} }
return syndEntry; return syndEntry;
@ -104,11 +104,11 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
final Item item = super.createRSSItem(sEntry); final Item item = super.createRSSItem(sEntry);
final List<SyndCategory> sCats = sEntry.getCategories(); // c final List<SyndCategory> sCats = sEntry.getCategories(); // c
if (sCats.size() > 0) { if (!sCats.isEmpty()) {
item.setCategories(createRSSCategories(sCats)); item.setCategories(createRSSCategories(sCats));
} }
final List<SyndEnclosure> sEnclosures = sEntry.getEnclosures(); final List<SyndEnclosure> sEnclosures = sEntry.getEnclosures();
if (sEnclosures.size() > 0) { if (!sEnclosures.isEmpty()) {
item.setEnclosures(createEnclosures(sEnclosures)); item.setEnclosures(createEnclosures(sEnclosures));
} }
return item; return item;

View file

@ -51,7 +51,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
final Channel channel = (Channel) feed; final Channel channel = (Channel) feed;
super.copyInto(channel, syndFeed); super.copyInto(channel, syndFeed);
final List<Category> cats = channel.getCategories(); // c final List<Category> cats = channel.getCategories(); // c
if (cats.size() > 0) { if (!cats.isEmpty()) {
final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>(); // using a final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>(); // using a
// set to // set to
// remove // remove
@ -105,7 +105,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
protected WireFeed createRealFeed(final String type, final SyndFeed syndFeed) { protected WireFeed createRealFeed(final String type, final SyndFeed syndFeed) {
final Channel channel = (Channel) super.createRealFeed(type, syndFeed); final Channel channel = (Channel) super.createRealFeed(type, syndFeed);
final List<SyndCategory> cats = syndFeed.getCategories(); // c final List<SyndCategory> cats = syndFeed.getCategories(); // c
if (cats.size() > 0) { if (!cats.isEmpty()) {
channel.setCategories(createRSSCategories(cats)); channel.setCategories(createRSSCategories(cats));
} }
return channel; return channel;
@ -114,7 +114,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
@Override @Override
protected Item createRSSItem(final SyndEntry sEntry) { protected Item createRSSItem(final SyndEntry sEntry) {
final Item item = super.createRSSItem(sEntry); final Item item = super.createRSSItem(sEntry);
if (sEntry.getAuthors() != null && sEntry.getAuthors().size() > 0) { if (sEntry.getAuthors() != null && !sEntry.getAuthors().isEmpty()) {
final SyndPerson author = sEntry.getAuthors().get(0); final SyndPerson author = sEntry.getAuthors().get(0);
item.setAuthor(author.getEmail()); item.setAuthor(author.getEmail());
} }

View file

@ -107,7 +107,7 @@ public class ConverterForRSS10 extends ConverterForRSS090 {
item.setDescription(createItemDescription(desc)); item.setDescription(createItemDescription(desc));
} }
final List<SyndContent> contents = sEntry.getContents(); final List<SyndContent> contents = sEntry.getContents();
if (contents != null && contents.size() > 0) { if (contents != null && !contents.isEmpty()) {
item.setContent(createItemContent(contents.get(0))); item.setContent(createItemContent(contents.get(0)));
} }

View file

@ -133,7 +133,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
for (int i = 0; i < links.size(); i++) { for (int i = 0; i < links.size(); i++) {
eFeed.addContent(generateLinkElement(links.get(i))); eFeed.addContent(generateLinkElement(links.get(i)));
} }
if (feed.getAuthors() != null && feed.getAuthors().size() > 0) { if (feed.getAuthors() != null && !feed.getAuthors().isEmpty()) {
final Element authorElement = new Element("author", getFeedNamespace()); final Element authorElement = new Element("author", getFeedNamespace());
fillPersonElement(authorElement, feed.getAuthors().get(0)); fillPersonElement(authorElement, feed.getAuthors().get(0));
eFeed.addContent(authorElement); eFeed.addContent(authorElement);
@ -193,7 +193,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
eEntry.addContent(generateLinkElement(links.get(i))); eEntry.addContent(generateLinkElement(links.get(i)));
} }
if (entry.getAuthors() != null && entry.getAuthors().size() > 0) { if (entry.getAuthors() != null && !entry.getAuthors().isEmpty()) {
final Element authorElement = new Element("author", getFeedNamespace()); final Element authorElement = new Element("author", getFeedNamespace());
fillPersonElement(authorElement, entry.getAuthors().get(0)); fillPersonElement(authorElement, entry.getAuthors().get(0));
eEntry.addContent(authorElement); eEntry.addContent(authorElement);

View file

@ -101,7 +101,7 @@ public class Atom03Parser extends BaseWireFeedParser {
} }
eList = eFeed.getChildren("contributor", getAtomNamespace()); eList = eFeed.getChildren("contributor", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
feed.setContributors(parsePersons(eList)); feed.setContributors(parsePersons(eList));
} }
@ -148,12 +148,12 @@ public class Atom03Parser extends BaseWireFeedParser {
feed.setModules(parseFeedModules(eFeed, locale)); feed.setModules(parseFeedModules(eFeed, locale));
eList = eFeed.getChildren("entry", getAtomNamespace()); eList = eFeed.getChildren("entry", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
feed.setEntries(parseEntries(eList, locale)); feed.setEntries(parseEntries(eList, locale));
} }
final List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace()); final List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace());
if (foreignMarkup.size() > 0) { if (!foreignMarkup.isEmpty()) {
feed.setForeignMarkup(foreignMarkup); feed.setForeignMarkup(foreignMarkup);
} }
return feed; return feed;
@ -192,7 +192,7 @@ public class Atom03Parser extends BaseWireFeedParser {
} }
} }
} }
if (links.size() > 0) { if (!links.isEmpty()) {
return links; return links;
} else { } else {
return null; return null;
@ -232,7 +232,7 @@ public class Atom03Parser extends BaseWireFeedParser {
for (int i = 0; i < ePersons.size(); i++) { for (int i = 0; i < ePersons.size(); i++) {
persons.add(parsePerson(ePersons.get(i))); persons.add(parsePerson(ePersons.get(i)));
} }
if (persons.size() > 0) { if (!persons.isEmpty()) {
return persons; return persons;
} else { } else {
return null; return null;
@ -282,7 +282,7 @@ public class Atom03Parser extends BaseWireFeedParser {
for (int i = 0; i < eEntries.size(); i++) { for (int i = 0; i < eEntries.size(); i++) {
entries.add(parseEntry(eEntries.get(i), locale)); entries.add(parseEntry(eEntries.get(i), locale));
} }
if (entries.size() > 0) { if (!entries.isEmpty()) {
return entries; return entries;
} else { } else {
return null; return null;
@ -309,7 +309,7 @@ public class Atom03Parser extends BaseWireFeedParser {
} }
eList = eEntry.getChildren("contributor", getAtomNamespace()); eList = eEntry.getChildren("contributor", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
entry.setContributors(parsePersons(eList)); entry.setContributors(parsePersons(eList));
} }
@ -339,7 +339,7 @@ public class Atom03Parser extends BaseWireFeedParser {
} }
eList = eEntry.getChildren("content", getAtomNamespace()); eList = eEntry.getChildren("content", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
final List<Content> content = new ArrayList<Content>(); final List<Content> content = new ArrayList<Content>();
for (int i = 0; i < eList.size(); i++) { for (int i = 0; i < eList.size(); i++) {
content.add(parseContent(eList.get(i))); content.add(parseContent(eList.get(i)));
@ -350,7 +350,7 @@ public class Atom03Parser extends BaseWireFeedParser {
entry.setModules(parseItemModules(eEntry, locale)); entry.setModules(parseItemModules(eEntry, locale));
final List<Element> foreignMarkup = extractForeignMarkup(eEntry, entry, getAtomNamespace()); final List<Element> foreignMarkup = extractForeignMarkup(eEntry, entry, getAtomNamespace());
if (foreignMarkup.size() > 0) { if (!foreignMarkup.isEmpty()) {
entry.setForeignMarkup(foreignMarkup); entry.setForeignMarkup(foreignMarkup);
} }
return entry; return entry;

View file

@ -159,7 +159,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
} }
final List<SyndPerson> authors = feed.getAuthors(); final List<SyndPerson> authors = feed.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
for (int i = 0; i < authors.size(); i++) { for (int i = 0; i < authors.size(); i++) {
final Element authorElement = new Element("author", getFeedNamespace()); final Element authorElement = new Element("author", getFeedNamespace());
fillPersonElement(authorElement, feed.getAuthors().get(i)); fillPersonElement(authorElement, feed.getAuthors().get(i));
@ -168,7 +168,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
} }
final List<SyndPerson> contributors = feed.getContributors(); final List<SyndPerson> contributors = feed.getContributors();
if (contributors != null && contributors.size() > 0) { if (contributors != null && !contributors.isEmpty()) {
for (int i = 0; i < contributors.size(); i++) { for (int i = 0; i < contributors.size(); i++) {
final Element contributorElement = new Element("contributor", getFeedNamespace()); final Element contributorElement = new Element("contributor", getFeedNamespace());
fillPersonElement(contributorElement, contributors.get(i)); fillPersonElement(contributorElement, contributors.get(i));
@ -236,7 +236,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
} }
final List<SyndPerson> authors = entry.getAuthors(); final List<SyndPerson> authors = entry.getAuthors();
if (authors != null && authors.size() > 0) { if (authors != null && !authors.isEmpty()) {
for (int i = 0; i < authors.size(); i++) { for (int i = 0; i < authors.size(); i++) {
final Element authorElement = new Element("author", getFeedNamespace()); final Element authorElement = new Element("author", getFeedNamespace());
fillPersonElement(authorElement, entry.getAuthors().get(i)); fillPersonElement(authorElement, entry.getAuthors().get(i));
@ -245,7 +245,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
} }
final List<SyndPerson> contributors = entry.getContributors(); final List<SyndPerson> contributors = entry.getContributors();
if (contributors != null && contributors.size() > 0) { if (contributors != null && !contributors.isEmpty()) {
for (int i = 0; i < contributors.size(); i++) { for (int i = 0; i < contributors.size(); i++) {
final Element contributorElement = new Element("contributor", getFeedNamespace()); final Element contributorElement = new Element("contributor", getFeedNamespace());
fillPersonElement(contributorElement, contributors.get(i)); fillPersonElement(contributorElement, contributors.get(i));
@ -268,7 +268,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
eEntry.addContent(publishedElement); eEntry.addContent(publishedElement);
} }
if (entry.getContents() != null && entry.getContents().size() > 0) { if (entry.getContents() != null && !entry.getContents().isEmpty()) {
final Element contentElement = new Element("content", getFeedNamespace()); final Element contentElement = new Element("content", getFeedNamespace());
final Content content = entry.getContents().get(0); final Content content = entry.getContents().get(0);
fillContentElement(contentElement, content); fillContentElement(contentElement, content);

View file

@ -123,12 +123,12 @@ public class Atom10Parser extends BaseWireFeedParser {
feed.setModules(parseFeedModules(eFeed, locale)); feed.setModules(parseFeedModules(eFeed, locale));
final List<Element> eList = eFeed.getChildren("entry", getAtomNamespace()); final List<Element> eList = eFeed.getChildren("entry", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
feed.setEntries(parseEntries(feed, baseURI, eList, locale)); feed.setEntries(parseEntries(feed, baseURI, eList, locale));
} }
final List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace()); final List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace());
if (foreignMarkup.size() > 0) { if (!foreignMarkup.isEmpty()) {
feed.setForeignMarkup(foreignMarkup); feed.setForeignMarkup(foreignMarkup);
} }
return feed; return feed;
@ -153,12 +153,12 @@ public class Atom10Parser extends BaseWireFeedParser {
feed.setCategories(parseCategories(baseURI, cList)); feed.setCategories(parseCategories(baseURI, cList));
eList = eFeed.getChildren("author", getAtomNamespace()); eList = eFeed.getChildren("author", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
feed.setAuthors(parsePersons(baseURI, eList, locale)); feed.setAuthors(parsePersons(baseURI, eList, locale));
} }
eList = eFeed.getChildren("contributor", getAtomNamespace()); eList = eFeed.getChildren("contributor", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
feed.setContributors(parsePersons(baseURI, eList, locale)); feed.setContributors(parsePersons(baseURI, eList, locale));
} }
@ -258,7 +258,7 @@ public class Atom10Parser extends BaseWireFeedParser {
links.add(link); links.add(link);
} }
} }
if (links.size() > 0) { if (!links.isEmpty()) {
return links; return links;
} else { } else {
return null; return null;
@ -274,7 +274,7 @@ public class Atom10Parser extends BaseWireFeedParser {
links.add(link); links.add(link);
} }
} }
if (links.size() > 0) { if (!links.isEmpty()) {
return links; return links;
} else { } else {
return null; return null;
@ -308,7 +308,7 @@ public class Atom10Parser extends BaseWireFeedParser {
for (int i = 0; i < ePersons.size(); i++) { for (int i = 0; i < ePersons.size(); i++) {
persons.add(parsePerson(baseURI, ePersons.get(i), locale)); persons.add(parsePerson(baseURI, ePersons.get(i), locale));
} }
if (persons.size() > 0) { if (!persons.isEmpty()) {
return persons; return persons;
} else { } else {
return null; return null;
@ -358,7 +358,7 @@ public class Atom10Parser extends BaseWireFeedParser {
for (int i = 0; i < eEntries.size(); i++) { for (int i = 0; i < eEntries.size(); i++) {
entries.add(this.parseEntry(feed, eEntries.get(i), baseURI, locale)); entries.add(this.parseEntry(feed, eEntries.get(i), baseURI, locale));
} }
if (entries.size() > 0) { if (!entries.isEmpty()) {
return entries; return entries;
} else { } else {
return null; return null;
@ -386,12 +386,12 @@ public class Atom10Parser extends BaseWireFeedParser {
entry.setOtherLinks(parseOtherLinks(feed, entry, baseURI, eList)); entry.setOtherLinks(parseOtherLinks(feed, entry, baseURI, eList));
eList = eEntry.getChildren("author", getAtomNamespace()); eList = eEntry.getChildren("author", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
entry.setAuthors(parsePersons(baseURI, eList, locale)); entry.setAuthors(parsePersons(baseURI, eList, locale));
} }
eList = eEntry.getChildren("contributor", getAtomNamespace()); eList = eEntry.getChildren("contributor", getAtomNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
entry.setContributors(parsePersons(baseURI, eList, locale)); entry.setContributors(parsePersons(baseURI, eList, locale));
} }
@ -439,7 +439,7 @@ public class Atom10Parser extends BaseWireFeedParser {
entry.setModules(parseItemModules(eEntry, locale)); entry.setModules(parseItemModules(eEntry, locale));
final List<Element> foreignMarkup = extractForeignMarkup(eEntry, entry, getAtomNamespace()); final List<Element> foreignMarkup = extractForeignMarkup(eEntry, entry, getAtomNamespace());
if (foreignMarkup.size() > 0) { if (!foreignMarkup.isEmpty()) {
entry.setForeignMarkup(foreignMarkup); entry.setForeignMarkup(foreignMarkup);
} }
return entry; return entry;
@ -451,7 +451,7 @@ public class Atom10Parser extends BaseWireFeedParser {
final Element eCategory = eCategories.get(i); final Element eCategory = eCategories.get(i);
cats.add(parseCategory(baseURI, eCategory)); cats.add(parseCategory(baseURI, eCategory));
} }
if (cats.size() > 0) { if (!cats.isEmpty()) {
return cats; return cats;
} else { } else {
return null; return null;

View file

@ -75,77 +75,77 @@ public class DCModuleParser implements ModuleParser {
final DCModule dcm = new DCModuleImpl(); final DCModule dcm = new DCModuleImpl();
List<Element> eList = dcRoot.getChildren("title", getDCNamespace()); List<Element> eList = dcRoot.getChildren("title", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setTitles(parseElementList(eList)); dcm.setTitles(parseElementList(eList));
} }
eList = dcRoot.getChildren("creator", getDCNamespace()); eList = dcRoot.getChildren("creator", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setCreators(parseElementList(eList)); dcm.setCreators(parseElementList(eList));
} }
eList = dcRoot.getChildren("subject", getDCNamespace()); eList = dcRoot.getChildren("subject", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setSubjects(parseSubjects(eList)); dcm.setSubjects(parseSubjects(eList));
} }
eList = dcRoot.getChildren("description", getDCNamespace()); eList = dcRoot.getChildren("description", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setDescriptions(parseElementList(eList)); dcm.setDescriptions(parseElementList(eList));
} }
eList = dcRoot.getChildren("publisher", getDCNamespace()); eList = dcRoot.getChildren("publisher", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setPublishers(parseElementList(eList)); dcm.setPublishers(parseElementList(eList));
} }
eList = dcRoot.getChildren("contributor", getDCNamespace()); eList = dcRoot.getChildren("contributor", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setContributors(parseElementList(eList)); dcm.setContributors(parseElementList(eList));
} }
eList = dcRoot.getChildren("date", getDCNamespace()); eList = dcRoot.getChildren("date", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setDates(parseElementListDate(eList, locale)); dcm.setDates(parseElementListDate(eList, locale));
} }
eList = dcRoot.getChildren("type", getDCNamespace()); eList = dcRoot.getChildren("type", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setTypes(parseElementList(eList)); dcm.setTypes(parseElementList(eList));
} }
eList = dcRoot.getChildren("format", getDCNamespace()); eList = dcRoot.getChildren("format", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setFormats(parseElementList(eList)); dcm.setFormats(parseElementList(eList));
} }
eList = dcRoot.getChildren("identifier", getDCNamespace()); eList = dcRoot.getChildren("identifier", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setIdentifiers(parseElementList(eList)); dcm.setIdentifiers(parseElementList(eList));
} }
eList = dcRoot.getChildren("source", getDCNamespace()); eList = dcRoot.getChildren("source", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setSources(parseElementList(eList)); dcm.setSources(parseElementList(eList));
} }
eList = dcRoot.getChildren("language", getDCNamespace()); eList = dcRoot.getChildren("language", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setLanguages(parseElementList(eList)); dcm.setLanguages(parseElementList(eList));
} }
eList = dcRoot.getChildren("relation", getDCNamespace()); eList = dcRoot.getChildren("relation", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setRelations(parseElementList(eList)); dcm.setRelations(parseElementList(eList));
} }
eList = dcRoot.getChildren("coverage", getDCNamespace()); eList = dcRoot.getChildren("coverage", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setCoverages(parseElementList(eList)); dcm.setCoverages(parseElementList(eList));
} }
eList = dcRoot.getChildren("rights", getDCNamespace()); eList = dcRoot.getChildren("rights", getDCNamespace());
if (eList.size() > 0) { if (!eList.isEmpty()) {
foundSomething = true; foundSomething = true;
dcm.setRightsList(parseElementList(eList)); dcm.setRightsList(parseElementList(eList));
} }

View file

@ -186,7 +186,7 @@ public class RSS090Parser extends BaseWireFeedParser {
channel.setItems(parseItems(rssRoot, locale)); channel.setItems(parseItems(rssRoot, locale));
final List<Element> foreignMarkup = extractForeignMarkup(eChannel, channel, getRSSNamespace()); final List<Element> foreignMarkup = extractForeignMarkup(eChannel, channel, getRSSNamespace());
if (foreignMarkup.size() > 0) { if (!foreignMarkup.isEmpty()) {
channel.setForeignMarkup(foreignMarkup); channel.setForeignMarkup(foreignMarkup);
} }
return channel; return channel;

View file

@ -231,13 +231,13 @@ public class RSS091UserlandGenerator extends RSS090Generator {
final List<Integer> skipHours = channel.getSkipHours(); final List<Integer> skipHours = channel.getSkipHours();
if (skipHours != null && skipHours.size() > 0) { if (skipHours != null && !skipHours.isEmpty()) {
eChannel.addContent(generateSkipHoursElement(skipHours)); eChannel.addContent(generateSkipHoursElement(skipHours));
} }
final List<String> skipDays = channel.getSkipDays(); final List<String> skipDays = channel.getSkipDays();
if (skipDays != null && skipDays.size() > 0) { if (skipDays != null && !skipDays.isEmpty()) {
eChannel.addContent(generateSkipDaysElement(skipDays)); eChannel.addContent(generateSkipDaysElement(skipDays));
} }
} }

View file

@ -84,7 +84,7 @@ public class RSS092Generator extends RSS091UserlandGenerator {
// Another one to thanks DW for // Another one to thanks DW for
protected int getNumberOfEnclosures(final List<Enclosure> enclosures) { protected int getNumberOfEnclosures(final List<Enclosure> enclosures) {
if (enclosures.size() > 0) { if (!enclosures.isEmpty()) {
return 1; return 1;
} else { } else {
return 0; return 0;

View file

@ -117,7 +117,7 @@ public class RSS092Parser extends RSS091UserlandParser {
// WHY // WHY
// DOESN'T // DOESN'T
// WORK // WORK
if (eEnclosures.size() > 0) { if (!eEnclosures.isEmpty()) {
final List<Enclosure> enclosures = new ArrayList<Enclosure>(); final List<Enclosure> enclosures = new ArrayList<Enclosure>();
for (int i = 0; i < eEnclosures.size(); i++) { for (int i = 0; i < eEnclosures.size(); i++) {
e = eEnclosures.get(i); e = eEnclosures.get(i);
@ -153,7 +153,7 @@ public class RSS092Parser extends RSS091UserlandParser {
protected List<Category> parseCategories(final List<Element> eCats) { protected List<Category> parseCategories(final List<Element> eCats) {
List<Category> cats = null; List<Category> cats = null;
if (eCats.size() > 0) { if (!eCats.isEmpty()) {
cats = new ArrayList<Category>(); cats = new ArrayList<Category>();
for (int i = 0; i < eCats.size(); i++) { for (int i = 0; i < eCats.size(); i++) {
final Category cat = new Category(); final Category cat = new Category();

View file

@ -59,7 +59,7 @@ public class RSS10Generator extends RSS090Generator {
eChannel.setAttribute("about", channel.getUri(), getRDFNamespace()); eChannel.setAttribute("about", channel.getUri(), getRDFNamespace());
} }
final List<Item> items = channel.getItems(); final List<Item> items = channel.getItems();
if (items.size() > 0) { if (!items.isEmpty()) {
final Element eItems = new Element("items", getFeedNamespace()); final Element eItems = new Element("items", getFeedNamespace());
final Element eSeq = new Element("Seq", getRDFNamespace()); final Element eSeq = new Element("Seq", getRDFNamespace());
for (int i = 0; i < items.size(); i++) { for (int i = 0; i < items.size(); i++) {