Skip to content

Commit 222d869

Browse files
committed
Polish: Use ternary instead of if
1 parent 625e9f9 commit 222d869

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSubscriptionExtractor.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,12 @@ public List<SubscriptionItem> fromCsvInputStream(@Nonnull final InputStream cont
149149
.map(values -> {
150150
// Channel URL from second entry
151151
final String channelUrl = values[1].replace("http://", "https://");
152-
if (!channelUrl.startsWith(BASE_CHANNEL_URL)) {
153-
return null;
154-
} else {
155-
// Channel title from third entry
156-
final String title = values[2];
157-
return new SubscriptionItem(service.getServiceId(), channelUrl, title);
158-
}
152+
return channelUrl.startsWith(BASE_CHANNEL_URL)
153+
? new SubscriptionItem(
154+
service.getServiceId(),
155+
channelUrl,
156+
values[2]) // Channel title from third entry
157+
: null;
159158
})
160159
.filter(Objects::nonNull)
161160
.collect(Collectors.toUnmodifiableList());

0 commit comments

Comments
 (0)