@@ -75,7 +75,7 @@ private BlockingObservable() {
75
75
/**
76
76
* Convert an Observable into a BlockingObservable.
77
77
*/
78
- public static <T > BlockingObservable <T > from (final Observable <T > o ) {
78
+ public static <T > BlockingObservable <T > from (final Observable <? extends T > o ) {
79
79
return new BlockingObservable <T >(new Func1 <Observer <? super T >, Subscription >() {
80
80
81
81
@ Override
@@ -97,7 +97,7 @@ public Subscription call(Observer<? super T> observer) {
97
97
* the type of items emitted by the source {@link Observable}
98
98
* @return an {@link Iterator} that can iterate over the items emitted by the {@link Observable}
99
99
*/
100
- public static <T > Iterator <T > toIterator (Observable <T > source ) {
100
+ public static <T > Iterator <T > toIterator (Observable <? extends T > source ) {
101
101
return OperationToIterator .toIterator (source );
102
102
}
103
103
@@ -110,7 +110,7 @@ public static <T> Iterator<T> toIterator(Observable<T> source) {
110
110
* the source {@link Observable}
111
111
* @return the last item emitted by the source {@link Observable}
112
112
*/
113
- public static <T > T last (final Observable <T > source ) {
113
+ public static <T > T last (final Observable <? extends T > source ) {
114
114
return from (source ).last ();
115
115
}
116
116
@@ -126,7 +126,7 @@ public static <T> T last(final Observable<T> source) {
126
126
* @return the last item emitted by the {@link Observable} for which the predicate function
127
127
* returns <code>true</code>
128
128
*/
129
- public static <T > T last (final Observable <T > source , final Func1 <? super T , Boolean > predicate ) {
129
+ public static <T > T last (final Observable <? extends T > source , final Func1 <? super T , Boolean > predicate ) {
130
130
return last (source .filter (predicate ));
131
131
}
132
132
@@ -145,7 +145,7 @@ public static <T> T last(final Observable<T> source, final Func1<? super T, Bool
145
145
* @return the last item emitted by an {@link Observable}, or the default value if no item is
146
146
* emitted
147
147
*/
148
- public static <T > T lastOrDefault (Observable <T > source , T defaultValue ) {
148
+ public static <T > T lastOrDefault (Observable <? extends T > source , T defaultValue ) {
149
149
return from (source ).lastOrDefault (defaultValue );
150
150
}
151
151
@@ -166,7 +166,7 @@ public static <T> T lastOrDefault(Observable<T> source, T defaultValue) {
166
166
* @return the last item emitted by an {@link Observable} that matches the predicate, or the
167
167
* default value if no matching item is emitted
168
168
*/
169
- public static <T > T lastOrDefault (Observable <T > source , T defaultValue , Func1 <? super T , Boolean > predicate ) {
169
+ public static <T > T lastOrDefault (Observable <? extends T > source , T defaultValue , Func1 <? super T , Boolean > predicate ) {
170
170
return lastOrDefault (source .filter (predicate ), defaultValue );
171
171
}
172
172
@@ -186,7 +186,7 @@ public static <T> T lastOrDefault(Observable<T> source, T defaultValue, Func1<?
186
186
* @return an {@link Iterable} that on each iteration returns the item that the
187
187
* {@link Observable} has most recently emitted
188
188
*/
189
- public static <T > Iterable <T > mostRecent (Observable <T > source , T initialValue ) {
189
+ public static <T > Iterable <T > mostRecent (Observable <? extends T > source , T initialValue ) {
190
190
return OperationMostRecent .mostRecent (source , initialValue );
191
191
}
192
192
@@ -203,12 +203,12 @@ public static <T> Iterable<T> mostRecent(Observable<T> source, T initialValue) {
203
203
* @return an {@link Iterable} that blocks upon each iteration until the {@link Observable}
204
204
* emits a new item, whereupon the Iterable returns that item
205
205
*/
206
- public static <T > Iterable <T > next (Observable <T > items ) {
206
+ public static <T > Iterable <T > next (Observable <? extends T > items ) {
207
207
return OperationNext .next (items );
208
208
}
209
209
210
- private static <T > T _singleOrDefault (BlockingObservable <T > source , boolean hasDefault , T defaultValue ) {
211
- Iterator <T > it = source .toIterable ().iterator ();
210
+ private static <T > T _singleOrDefault (BlockingObservable <? extends T > source , boolean hasDefault , T defaultValue ) {
211
+ Iterator <? extends T > it = source .toIterable ().iterator ();
212
212
213
213
if (!it .hasNext ()) {
214
214
if (hasDefault ) {
@@ -238,7 +238,7 @@ private static <T> T _singleOrDefault(BlockingObservable<T> source, boolean hasD
238
238
* @throws IllegalStateException
239
239
* if the {@link Observable} does not emit exactly one item
240
240
*/
241
- public static <T > T single (Observable <T > source ) {
241
+ public static <T > T single (Observable <? extends T > source ) {
242
242
return from (source ).single ();
243
243
}
244
244
@@ -257,7 +257,7 @@ public static <T> T single(Observable<T> source) {
257
257
* if the {@link Observable} does not emit exactly one item that matches the
258
258
* predicate
259
259
*/
260
- public static <T > T single (Observable <T > source , Func1 <? super T , Boolean > predicate ) {
260
+ public static <T > T single (Observable <? extends T > source , Func1 <? super T , Boolean > predicate ) {
261
261
return from (source ).single (predicate );
262
262
}
263
263
@@ -274,7 +274,7 @@ public static <T> T single(Observable<T> source, Func1<? super T, Boolean> predi
274
274
* @return the single item emitted by the source {@link Observable}, or a default value if no
275
275
* value is emitted
276
276
*/
277
- public static <T > T singleOrDefault (Observable <T > source , T defaultValue ) {
277
+ public static <T > T singleOrDefault (Observable <? extends T > source , T defaultValue ) {
278
278
return from (source ).singleOrDefault (defaultValue );
279
279
}
280
280
@@ -293,7 +293,7 @@ public static <T> T singleOrDefault(Observable<T> source, T defaultValue) {
293
293
* @return the single item emitted by the source {@link Observable} that matches the predicate,
294
294
* or a default value if no such value is emitted
295
295
*/
296
- public static <T > T singleOrDefault (Observable <T > source , T defaultValue , Func1 <? super T , Boolean > predicate ) {
296
+ public static <T > T singleOrDefault (Observable <? extends T > source , T defaultValue , Func1 <? super T , Boolean > predicate ) {
297
297
return from (source ).singleOrDefault (defaultValue , predicate );
298
298
}
299
299
@@ -310,7 +310,7 @@ public static <T> T singleOrDefault(Observable<T> source, T defaultValue, Func1<
310
310
* the source {@link Observable}
311
311
* @return a Future that expects a single item to be emitted by the source {@link Observable}
312
312
*/
313
- public static <T > Future <T > toFuture (final Observable <T > source ) {
313
+ public static <T > Future <T > toFuture (final Observable <? extends T > source ) {
314
314
return OperationToFuture .toFuture (source );
315
315
}
316
316
@@ -323,7 +323,7 @@ public static <T> Future<T> toFuture(final Observable<T> source) {
323
323
* the source {@link Observable}
324
324
* @return an {@link Iterable} version of the underlying {@link Observable}
325
325
*/
326
- public static <T > Iterable <T > toIterable (final Observable <T > source ) {
326
+ public static <T > Iterable <T > toIterable (final Observable <? extends T > source ) {
327
327
return from (source ).toIterable ();
328
328
}
329
329
@@ -334,7 +334,7 @@ public static <T> Iterable<T> toIterable(final Observable<T> source) {
334
334
* See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect
335
335
* calls to user code from within an operator"
336
336
*/
337
- private Subscription protectivelyWrapAndSubscribe (Observer <T > o ) {
337
+ private Subscription protectivelyWrapAndSubscribe (Observer <? super T > o ) {
338
338
SafeObservableSubscription subscription = new SafeObservableSubscription ();
339
339
return subscription .wrap (subscribe (new SafeObserver <T >(subscription , o )));
340
340
}
0 commit comments