Use Collections.singletonList().
This commit is contained in:
parent
ff60e05c76
commit
1af6b8eedb
|
@ -31,7 +31,6 @@ import org.schabi.newpipe.extractor.utils.Utils;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -149,8 +148,7 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
|
||||
@Override
|
||||
public List<AudioStream> getAudioStreams() {
|
||||
final List<AudioStream> audioStreams = new ArrayList<>();
|
||||
audioStreams.add(new AudioStream.Builder()
|
||||
return Collections.singletonList(new AudioStream.Builder()
|
||||
.setId("mp3-128")
|
||||
.setContent(albumJson.getArray("trackinfo")
|
||||
.getObject(0)
|
||||
|
@ -159,7 +157,6 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
|||
.setMediaFormat(MediaFormat.MP3)
|
||||
.setAverageBitrate(128)
|
||||
.build());
|
||||
return audioStreams;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,7 +65,6 @@ import java.time.OffsetDateTime;
|
|||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -1325,10 +1324,9 @@ public final class YoutubeParsingHelper {
|
|||
* @see #CONSENT_COOKIE
|
||||
* @param headers the headers which should be completed
|
||||
*/
|
||||
@SuppressWarnings("ArraysAsListWithZeroOrOneArgument")
|
||||
public static void addCookieHeader(@Nonnull final Map<String, List<String>> headers) {
|
||||
if (headers.get("Cookie") == null) {
|
||||
headers.put("Cookie", Arrays.asList(generateConsentCookie()));
|
||||
headers.put("Cookie", Collections.singletonList(generateConsentCookie()));
|
||||
} else {
|
||||
headers.get("Cookie").add(generateConsentCookie());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue