Skip to content

Commit cbbc6d2

Browse files
committed
Added the @nullable annotaions in ListExtractor.java
1 parent 8b9ccec commit cbbc6d2

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.List;
99

1010
import javax.annotation.Nonnull;
11-
11+
import javax.annotation.Nullable;
1212

1313
/**
1414
* Base class to extractors that have a list (e.g. playlists, users).
@@ -20,11 +20,13 @@ public abstract class ListExtractor<R extends InfoItem> extends Extractor {
2020
* a list has an unknown number of items.
2121
*/
2222
public static final long ITEM_COUNT_UNKNOWN = -1;
23+
2324
/**
2425
* Constant that should be returned whenever a list has an
2526
* infinite number of items. For example a YouTube mix.
2627
*/
2728
public static final long ITEM_COUNT_INFINITE = -2;
29+
2830
/**
2931
* Constant that should be returned whenever a list
3032
* has an unknown number of items bigger than 100.
@@ -69,8 +71,11 @@ public ListLinkHandler getLinkHandler() {
6971
* @param <T> the info item type that this page is supposed to store and provide
7072
*/
7173
public static class InfoItemsPage<T extends InfoItem> {
72-
private static final InfoItemsPage<InfoItem> EMPTY =
73-
new InfoItemsPage<>(Collections.emptyList(), null, Collections.emptyList());
74+
private static final InfoItemsPage<InfoItem> EMPTY = new InfoItemsPage<>(
75+
Collections.emptyList(),
76+
null,
77+
Collections.emptyList()
78+
);
7479

7580
/**
7681
* A convenient method that returns a representation of an empty page.
@@ -94,19 +99,21 @@ public static <T extends InfoItem> InfoItemsPage<T> emptyPage() {
9499
* @see ListExtractor#getPage(Page)
95100
* @see Page
96101
*/
102+
@Nullable
97103
private final Page nextPage;
98104

99105
/**
100106
* Errors that happened during the extraction
101107
*/
102108
private final List<Throwable> errors;
103109

104-
public InfoItemsPage(final InfoItemsCollector<T, ?> collector, final Page nextPage) {
110+
public InfoItemsPage(final InfoItemsCollector<T, ?> collector,
111+
@Nullable final Page nextPage) {
105112
this(collector.getItems(), nextPage, collector.getErrors());
106113
}
107114

108115
public InfoItemsPage(final List<T> itemsList,
109-
final Page nextPage,
116+
@Nullable final Page nextPage,
110117
final List<Throwable> errors) {
111118
this.itemsList = itemsList;
112119
this.nextPage = nextPage;
@@ -121,6 +128,10 @@ public List<T> getItems() {
121128
return itemsList;
122129
}
123130

131+
/**
132+
* @return the next page if available, or null otherwise
133+
*/
134+
@Nullable
124135
public Page getNextPage() {
125136
return nextPage;
126137
}

0 commit comments

Comments
 (0)