Skip to content

Commit

Permalink
return to Alternatives version
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Santos Izaguirre <[email protected]>
  • Loading branch information
antoniosanct committed Mar 12, 2023
1 parent 013b571 commit e20774f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.rometools.rome.feed.impl.CloneableBean;
import com.rometools.rome.feed.impl.EqualsBean;
import com.rometools.rome.feed.impl.ToStringBean;
import com.rometools.utils.Alternatives;

/**
* Bean for category elements of Atom feeds.
Expand Down Expand Up @@ -140,7 +141,7 @@ public void setSchemeResolved(final String schemeResolved) {
}

public String getSchemeResolved() {
return Stream.of(new String[] {schemeResolved, scheme}).filter(Objects::nonNull).findFirst().orElse(null);
return Alternatives.firstNotNull(schemeResolved, scheme);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion rome/src/main/java/com/rometools/rome/feed/atom/Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.rometools.rome.feed.impl.CloneableBean;
import com.rometools.rome.feed.impl.EqualsBean;
import com.rometools.rome.feed.impl.ToStringBean;
import com.rometools.utils.Alternatives;

/**
* Bean for link elements of Atom feeds.
Expand Down Expand Up @@ -167,7 +168,7 @@ public void setHrefResolved(final String hrefResolved) {
}

public String getHrefResolved() {
return Stream.of(new String[] {hrefResolved, href}).filter(Objects::nonNull).findFirst().orElse(null);
return Alternatives.firstNotNull(hrefResolved, href);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion rome/src/main/java/com/rometools/rome/feed/atom/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.rometools.rome.feed.module.Module;
import com.rometools.rome.feed.module.impl.ModuleUtils;
import com.rometools.rome.feed.synd.SyndPerson;
import com.rometools.utils.Alternatives;
import com.rometools.utils.Lists;

/**
Expand Down Expand Up @@ -147,7 +148,7 @@ public void setUriResolved(final String uriResolved) {
}

public String getUriResolved(final String resolveURI) {
return Stream.of(new String[] {uriResolved, uri}).filter(Objects::nonNull).findFirst().orElse(null);
return Alternatives.firstNotNull(uriResolved, uri);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.rometools.rome.feed.synd.SyndLinkImpl;
import com.rometools.rome.feed.synd.SyndPerson;
import com.rometools.rome.feed.synd.SyndPersonImpl;
import com.rometools.utils.Alternatives;
import com.rometools.utils.Lists;
import com.rometools.utils.Strings;

Expand Down Expand Up @@ -273,7 +274,7 @@ protected SyndEntry createSyndEntry(final Entry entry, final boolean preserveWir

Date date = entry.getModified();
if (date == null) {
date = Stream.of(new Date[] {entry.getIssued(), entry.getCreated()}).filter(Objects::nonNull).findFirst().orElse(null);
date = Alternatives.firstNotNull(entry.getIssued(), entry.getCreated());
}

if (date != null) {
Expand Down

0 comments on commit e20774f

Please sign in to comment.