Use Collections.emptyList() instead of Collections.EMPTY_LIST or new ArrayList()

This commit is contained in:
TobiGr 2021-02-16 20:25:48 +01:00
parent 5bf9fddba9
commit 16973126a0
4 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.utils.Utils; import org.schabi.newpipe.extractor.utils.Utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public abstract class ListLinkHandlerFactory extends LinkHandlerFactory { public abstract class ListLinkHandlerFactory extends LinkHandlerFactory {
@ -13,7 +14,7 @@ public abstract class ListLinkHandlerFactory extends LinkHandlerFactory {
/////////////////////////////////// ///////////////////////////////////
public List<String> getContentFilter(String url) throws ParsingException { public List<String> getContentFilter(String url) throws ParsingException {
return new ArrayList<>(0); return Collections.emptyList();
} }
public String getSortFilter(String url) throws ParsingException { public String getSortFilter(String url) throws ParsingException {

View File

@ -20,6 +20,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import static org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper.getImageUrl; import static org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper.getImageUrl;
@ -137,6 +138,6 @@ public class BandcampRadioStreamExtractor extends BandcampStreamExtractor {
@Nonnull @Nonnull
@Override @Override
public List<String> getTags() { public List<String> getTags() {
return new ArrayList<>(); return Collections.emptyList();
} }
} }

View File

@ -211,24 +211,24 @@ public class BandcampStreamExtractor extends StreamExtractor {
@Override @Override
public List<VideoStream> getVideoStreams() { public List<VideoStream> getVideoStreams() {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
@Override @Override
public List<VideoStream> getVideoOnlyStreams() { public List<VideoStream> getVideoOnlyStreams() {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
@Nonnull @Nonnull
@Override @Override
public List<SubtitlesStream> getSubtitlesDefault() { public List<SubtitlesStream> getSubtitlesDefault() {
return new ArrayList<>(); return Collections.emptyList();
} }
@Nonnull @Nonnull
@Override @Override
public List<SubtitlesStream> getSubtitles(MediaFormat format) { public List<SubtitlesStream> getSubtitles(MediaFormat format) {
return new ArrayList<>(); return Collections.emptyList();
} }
@Override @Override

View File

@ -15,6 +15,7 @@ import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class BandcampSuggestionExtractor extends SuggestionExtractor { public class BandcampSuggestionExtractor extends SuggestionExtractor {
@ -48,7 +49,7 @@ public class BandcampSuggestionExtractor extends SuggestionExtractor {
} catch (final JsonParserException e) { } catch (final JsonParserException e) {
e.printStackTrace(); e.printStackTrace();
return new ArrayList<>(); return Collections.emptyList();
} }