@@ -108,7 +108,7 @@ public class Observable<T> {
108
108
109
109
private final static RxJavaObservableExecutionHook hook = RxJavaPlugins .getInstance ().getObservableExecutionHook ();
110
110
111
- private final Func1 <Observer <T >, Subscription > onSubscribe ;
111
+ private final Func1 <? super Observer <T >, ? extends Subscription > onSubscribe ;
112
112
113
113
/**
114
114
* Observable with Function to execute when subscribed to.
@@ -119,7 +119,7 @@ public class Observable<T> {
119
119
* @param onSubscribe
120
120
* {@link Func1} to be executed when {@link #subscribe(Observer)} is called.
121
121
*/
122
- protected Observable (Func1 <Observer <T >, Subscription > onSubscribe ) {
122
+ protected Observable (Func1 <? super Observer <T >, ? extends Subscription > onSubscribe ) {
123
123
this .onSubscribe = onSubscribe ;
124
124
}
125
125
@@ -157,7 +157,7 @@ protected Observable() {
157
157
*/
158
158
public Subscription subscribe (Observer <T > observer ) {
159
159
// allow the hook to intercept and/or decorate
160
- Func1 <Observer <T >, Subscription > onSubscribeFunction = hook .onSubscribeStart (this , onSubscribe );
160
+ Func1 <? super Observer <T >, ? extends Subscription > onSubscribeFunction = hook .onSubscribeStart (this , onSubscribe );
161
161
// validate and proceed
162
162
if (observer == null ) {
163
163
throw new IllegalArgumentException ("observer can not be null" );
@@ -461,7 +461,7 @@ public Subscription call(Observer<T> observer) {
461
461
* @return an Observable that, when an {@link Observer} subscribes to it, will execute the given
462
462
* function
463
463
*/
464
- public static <T > Observable <T > create (Func1 <Observer <T >, Subscription > func ) {
464
+ public static <T > Observable <T > create (Func1 <? super Observer <T >, ? extends Subscription > func ) {
465
465
return new Observable <T >(func );
466
466
}
467
467
@@ -1096,7 +1096,7 @@ public Observable<List<T>> buffer(Func0<? extends Observable<BufferClosing>> buf
1096
1096
* @return
1097
1097
* An {@link Observable} which produces buffers which are created and emitted when the specified {@link Observable}s publish certain objects.
1098
1098
*/
1099
- public Observable <List <T >> buffer (Observable <BufferOpening > bufferOpenings , Func1 <BufferOpening , Observable <BufferClosing >> bufferClosingSelector ) {
1099
+ public Observable <List <T >> buffer (Observable <BufferOpening > bufferOpenings , Func1 <? super BufferOpening , ? extends Observable <BufferClosing >> bufferClosingSelector ) {
1100
1100
return create (OperationBuffer .buffer (this , bufferOpenings , bufferClosingSelector ));
1101
1101
}
1102
1102
@@ -1325,7 +1325,7 @@ public static <R> Observable<R> zip(Collection<Observable<?>> ws, FuncN<R> reduc
1325
1325
* @return an Observable that emits only those items in the original Observable that the filter
1326
1326
* evaluates as {@code true}
1327
1327
*/
1328
- public Observable <T > filter (Func1 <T , Boolean > predicate ) {
1328
+ public Observable <T > filter (Func1 <? super T , Boolean > predicate ) {
1329
1329
return create (OperationFilter .filter (this , predicate ));
1330
1330
}
1331
1331
@@ -1360,7 +1360,7 @@ public Observable<T> finallyDo(Action0 action) {
1360
1360
* obtained from this transformation.
1361
1361
* @see #mapMany(Func1)
1362
1362
*/
1363
- public <R > Observable <R > flatMap (Func1 <T , Observable <R >> func ) {
1363
+ public <R > Observable <R > flatMap (Func1 <? super T , ? extends Observable <R >> func ) {
1364
1364
return mapMany (func );
1365
1365
}
1366
1366
@@ -1374,7 +1374,7 @@ public <R> Observable<R> flatMap(Func1<T, Observable<R>> func) {
1374
1374
* evaluates as {@code true}
1375
1375
* @see #filter(Func1)
1376
1376
*/
1377
- public Observable <T > where (Func1 <T , Boolean > predicate ) {
1377
+ public Observable <T > where (Func1 <? super T , Boolean > predicate ) {
1378
1378
return filter (predicate );
1379
1379
}
1380
1380
@@ -1389,7 +1389,7 @@ public Observable<T> where(Func1<T, Boolean> predicate) {
1389
1389
* @return an Observable that emits the items from the source Observable, transformed by the
1390
1390
* given function
1391
1391
*/
1392
- public <R > Observable <R > map (Func1 <T , R > func ) {
1392
+ public <R > Observable <R > map (Func1 <? super T , ? extends R > func ) {
1393
1393
return create (OperationMap .map (this , func ));
1394
1394
}
1395
1395
@@ -1410,7 +1410,7 @@ public <R> Observable<R> map(Func1<T, R> func) {
1410
1410
* obtained from this transformation.
1411
1411
* @see #flatMap(Func1)
1412
1412
*/
1413
- public <R > Observable <R > mapMany (Func1 <T , Observable <R >> func ) {
1413
+ public <R > Observable <R > mapMany (Func1 <? super T , ? extends Observable <R >> func ) {
1414
1414
return create (OperationMap .mapMany (this , func ));
1415
1415
}
1416
1416
@@ -1496,7 +1496,7 @@ public <T2> Observable<T2> dematerialize() {
1496
1496
* encounters an error
1497
1497
* @return the original Observable, with appropriately modified behavior
1498
1498
*/
1499
- public Observable <T > onErrorResumeNext (final Func1 <Throwable , Observable <T >> resumeFunction ) {
1499
+ public Observable <T > onErrorResumeNext (final Func1 <? super Throwable , ? extends Observable <T >> resumeFunction ) {
1500
1500
return create (OperationOnErrorResumeNextViaFunction .onErrorResumeNextViaFunction (this , resumeFunction ));
1501
1501
}
1502
1502
@@ -1581,7 +1581,7 @@ public Observable<T> onExceptionResumeNext(final Observable<T> resumeSequence) {
1581
1581
* Observable encounters an error
1582
1582
* @return the original Observable with appropriately modified behavior
1583
1583
*/
1584
- public Observable <T > onErrorReturn (Func1 <Throwable , T > resumeFunction ) {
1584
+ public Observable <T > onErrorReturn (Func1 <? super Throwable , ? extends T > resumeFunction ) {
1585
1585
return create (OperationOnErrorReturn .onErrorReturn (this , resumeFunction ));
1586
1586
}
1587
1587
@@ -1800,7 +1800,7 @@ public <R> Observable<R> scan(R initialValue, Func2<R, T, R> accumulator) {
1800
1800
* @return an Observable that emits <code>true</code> if all items emitted by the source
1801
1801
* Observable satisfy the predicate; otherwise, <code>false</code>
1802
1802
*/
1803
- public Observable <Boolean > all (Func1 <T , Boolean > predicate ) {
1803
+ public Observable <Boolean > all (Func1 <? super T , Boolean > predicate ) {
1804
1804
return create (OperationAll .all (this , predicate ));
1805
1805
}
1806
1806
@@ -1853,7 +1853,7 @@ public Observable<T> take(final int num) {
1853
1853
* @return an Observable that emits the items from the source Observable so long as each item
1854
1854
* satisfies the condition defined by <code>predicate</code>
1855
1855
*/
1856
- public Observable <T > takeWhile (final Func1 <T , Boolean > predicate ) {
1856
+ public Observable <T > takeWhile (final Func1 <? super T , Boolean > predicate ) {
1857
1857
return create (OperationTakeWhile .takeWhile (this , predicate ));
1858
1858
}
1859
1859
@@ -1992,7 +1992,7 @@ public Observable<T> startWith(T... values) {
1992
1992
* unique key value and emits items representing items from the source Observable that
1993
1993
* share that key value
1994
1994
*/
1995
- public <K , R > Observable <GroupedObservable <K , R >> groupBy (final Func1 <T , K > keySelector , final Func1 <T , R > elementSelector ) {
1995
+ public <K , R > Observable <GroupedObservable <K , R >> groupBy (final Func1 <? super T , ? extends K > keySelector , final Func1 <? super T , ? extends R > elementSelector ) {
1996
1996
return create (OperationGroupBy .groupBy (this , keySelector , elementSelector ));
1997
1997
}
1998
1998
@@ -2010,7 +2010,7 @@ public <K, R> Observable<GroupedObservable<K, R>> groupBy(final Func1<T, K> keyS
2010
2010
* unique key value and emits items representing items from the source Observable that
2011
2011
* share that key value
2012
2012
*/
2013
- public <K > Observable <GroupedObservable <K , T >> groupBy (final Func1 <T , K > keySelector ) {
2013
+ public <K > Observable <GroupedObservable <K , T >> groupBy (final Func1 <? super T , ? extends K > keySelector ) {
2014
2014
return create (OperationGroupBy .groupBy (this , keySelector ));
2015
2015
}
2016
2016
0 commit comments