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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -51,13 +51,13 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
final Channel channel = (Channel) feed;
super.copyInto(channel, syndFeed);
final List<Category> cats = channel.getCategories(); // c
if (cats.size() > 0) {
if (!cats.isEmpty()) {
final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>(); // using a
// set to
// remove
// duplicates
s.addAll(createSyndCategories(cats)); // feed native categories
// (as
// (as
// syndcat)
s.addAll(syndFeed.getCategories()); // DC subjects (as syndcat)
syndFeed.setCategories(new ArrayList<SyndCategory>(s));
@ -105,7 +105,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
protected WireFeed createRealFeed(final String type, final SyndFeed syndFeed) {
final Channel channel = (Channel) super.createRealFeed(type, syndFeed);
final List<SyndCategory> cats = syndFeed.getCategories(); // c
if (cats.size() > 0) {
if (!cats.isEmpty()) {
channel.setCategories(createRSSCategories(cats));
}
return channel;
@ -114,7 +114,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
@Override
protected Item createRSSItem(final SyndEntry 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);
item.setAuthor(author.getEmail());
}

View file

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

View file

@ -38,9 +38,9 @@ import com.sun.syndication.io.FeedException;
/**
* Feed Generator for Atom
* <p/>
*
*
* @author Elaine Chien
*
*
*/
public class Atom03Generator extends BaseWireFeedGenerator {
@ -133,7 +133,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
for (int i = 0; i < links.size(); 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());
fillPersonElement(authorElement, feed.getAuthors().get(0));
eFeed.addContent(authorElement);
@ -193,7 +193,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
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());
fillPersonElement(authorElement, entry.getAuthors().get(0));
eEntry.addContent(authorElement);

View file

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

View file

@ -44,10 +44,10 @@ import com.sun.syndication.io.WireFeedOutput;
/**
* Feed Generator for Atom
* <p/>
*
*
* @author Elaine Chien
* @author Dave Johnson (updated for Atom 1.0)
*
*
*/
public class Atom10Generator extends BaseWireFeedGenerator {
@ -159,7 +159,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
}
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++) {
final Element authorElement = new Element("author", getFeedNamespace());
fillPersonElement(authorElement, feed.getAuthors().get(i));
@ -168,7 +168,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
}
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++) {
final Element contributorElement = new Element("contributor", getFeedNamespace());
fillPersonElement(contributorElement, contributors.get(i));
@ -236,7 +236,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
}
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++) {
final Element authorElement = new Element("author", getFeedNamespace());
fillPersonElement(authorElement, entry.getAuthors().get(i));
@ -245,7 +245,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
}
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++) {
final Element contributorElement = new Element("contributor", getFeedNamespace());
fillPersonElement(contributorElement, contributors.get(i));
@ -268,7 +268,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
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 Content content = entry.getContents().get(0);
fillContentElement(contentElement, content);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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