Use Set.of().

This commit is contained in:
Isira Seneviratne 2022-07-15 07:40:25 +05:30
parent ae369ec9ba
commit c53143ef4f
2 changed files with 3 additions and 6 deletions

View File

@ -2,7 +2,6 @@ package org.schabi.newpipe.util;
import android.text.TextUtils;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@ -20,6 +19,6 @@ public final class CookieUtils {
}
public static Set<String> splitCookies(final String cookies) {
return new HashSet<>(Arrays.asList(cookies.split("; *")));
return Set.of(cookies.split("; *"));
}
}

View File

@ -22,7 +22,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@ -40,9 +39,8 @@ public final class ListHelper {
// Audio format in order of efficiency. 0=most efficient, n=least efficient
private static final List<MediaFormat> AUDIO_FORMAT_EFFICIENCY_RANKING =
Arrays.asList(MediaFormat.WEBMA, MediaFormat.M4A, MediaFormat.MP3);
// Use a HashSet for better performance
private static final Set<String> HIGH_RESOLUTION_LIST = new HashSet<>(
Arrays.asList("1440p", "2160p"));
// Use a Set for better performance
private static final Set<String> HIGH_RESOLUTION_LIST = Set.of("1440p", "2160p");
private ListHelper() { }