Polish: Use ternary instead of if

This commit is contained in:
litetex 2025-01-27 22:32:01 +01:00
parent 625e9f96d2
commit 222d869efc
No known key found for this signature in database
GPG Key ID: 525B43E6039B3689

View File

@ -149,13 +149,12 @@ public class YoutubeSubscriptionExtractor extends SubscriptionExtractor {
.map(values -> {
// Channel URL from second entry
final String channelUrl = values[1].replace("http://", "https://");
if (!channelUrl.startsWith(BASE_CHANNEL_URL)) {
return null;
} else {
// Channel title from third entry
final String title = values[2];
return new SubscriptionItem(service.getServiceId(), channelUrl, title);
}
return channelUrl.startsWith(BASE_CHANNEL_URL)
? new SubscriptionItem(
service.getServiceId(),
channelUrl,
values[2]) // Channel title from third entry
: null;
})
.filter(Objects::nonNull)
.collect(Collectors.toUnmodifiableList());