1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 16:40:32 +00:00

Lint: 'size() == 0' replaceable with 'isEmpty()'

This commit is contained in:
TacoTheDank 2020-11-18 17:54:16 -05:00
parent 00b08318a5
commit 773bde14ab
4 changed files with 5 additions and 5 deletions

View File

@ -1140,7 +1140,7 @@ public final class VideoDetailFragment
PlayQueue queue = playQueue; PlayQueue queue = playQueue;
// Size can be 0 because queue removes bad stream automatically when error occurs // Size can be 0 because queue removes bad stream automatically when error occurs
if (queue == null || queue.size() == 0) { if (queue == null || queue.isEmpty()) {
queue = new SinglePlayQueue(currentInfo); queue = new SinglePlayQueue(currentInfo);
} }

View File

@ -204,7 +204,7 @@ public abstract class BaseListInfoFragment<I extends ListInfo>
name = result.getName(); name = result.getName();
setTitle(name); setTitle(name);
if (infoListAdapter.getItemsList().size() == 0) { if (infoListAdapter.getItemsList().isEmpty()) {
if (result.getRelatedItems().size() > 0) { if (result.getRelatedItems().size() > 0) {
infoListAdapter.addInfoItemList(result.getRelatedItems()); infoListAdapter.addInfoItemList(result.getRelatedItems());
showListFooter(hasMoreItems()); showListFooter(hasMoreItems());

View File

@ -256,7 +256,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
if (!TextUtils.isEmpty(searchString)) { if (!TextUtils.isEmpty(searchString)) {
if (wasLoading.getAndSet(false)) { if (wasLoading.getAndSet(false)) {
search(searchString, contentFilter, sortFilter); search(searchString, contentFilter, sortFilter);
} else if (infoListAdapter.getItemsList().size() == 0) { } else if (infoListAdapter.getItemsList().isEmpty()) {
if (savedState == null) { if (savedState == null) {
search(searchString, contentFilter, sortFilter); search(searchString, contentFilter, sortFilter);
} else if (!isLoading.get() && !wasSearchFocused) { } else if (!isLoading.get() && !wasSearchFocused) {
@ -977,7 +977,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
lastSearchedString = searchString; lastSearchedString = searchString;
nextPage = result.getNextPage(); nextPage = result.getNextPage();
if (infoListAdapter.getItemsList().size() == 0) { if (infoListAdapter.getItemsList().isEmpty()) {
if (!result.getRelatedItems().isEmpty()) { if (!result.getRelatedItems().isEmpty()) {
infoListAdapter.addInfoItemList(result.getRelatedItems()); infoListAdapter.addInfoItemList(result.getRelatedItems());
} else { } else {

View File

@ -81,7 +81,7 @@ public class TabsJsonHelperTest {
private boolean isTabsArrayEmpty(final String returnedJson) throws JsonParserException { private boolean isTabsArrayEmpty(final String returnedJson) throws JsonParserException {
final JsonObject jsonObject = JsonParser.object().from(returnedJson); final JsonObject jsonObject = JsonParser.object().from(returnedJson);
assertTrue(jsonObject.containsKey(JSON_TABS_ARRAY_KEY)); assertTrue(jsonObject.containsKey(JSON_TABS_ARRAY_KEY));
return jsonObject.getArray(JSON_TABS_ARRAY_KEY).size() == 0; return jsonObject.getArray(JSON_TABS_ARRAY_KEY).isEmpty();
} }
@Test @Test