@@ -252,13 +252,15 @@ public Subscription subscribe(final Map<String, Object> callbacks) {
252
252
*/
253
253
return protectivelyWrapAndSubscribe (new Observer () {
254
254
255
+ @ Override
255
256
public void onCompleted () {
256
257
Object onComplete = callbacks .get ("onCompleted" );
257
258
if (onComplete != null ) {
258
259
Functions .from (onComplete ).call ();
259
260
}
260
261
}
261
262
263
+ @ Override
262
264
public void onError (Exception e ) {
263
265
handleError (e );
264
266
Object onError = callbacks .get ("onError" );
@@ -267,6 +269,7 @@ public void onError(Exception e) {
267
269
}
268
270
}
269
271
272
+ @ Override
270
273
public void onNext (Object args ) {
271
274
onNext .call (args );
272
275
}
@@ -298,15 +301,18 @@ public Subscription subscribe(final Object o) {
298
301
*/
299
302
return protectivelyWrapAndSubscribe (new Observer () {
300
303
304
+ @ Override
301
305
public void onCompleted () {
302
306
// do nothing
303
307
}
304
308
309
+ @ Override
305
310
public void onError (Exception e ) {
306
311
handleError (e );
307
312
// no callback defined
308
313
}
309
314
315
+ @ Override
310
316
public void onNext (Object args ) {
311
317
onNext .call (args );
312
318
}
@@ -327,15 +333,18 @@ public Subscription subscribe(final Action1<T> onNext) {
327
333
*/
328
334
return protectivelyWrapAndSubscribe (new Observer <T >() {
329
335
336
+ @ Override
330
337
public void onCompleted () {
331
338
// do nothing
332
339
}
333
340
341
+ @ Override
334
342
public void onError (Exception e ) {
335
343
handleError (e );
336
344
// no callback defined
337
345
}
338
346
347
+ @ Override
339
348
public void onNext (T args ) {
340
349
if (onNext == null ) {
341
350
throw new RuntimeException ("onNext must be implemented" );
@@ -365,17 +374,20 @@ public Subscription subscribe(final Object onNext, final Object onError) {
365
374
*/
366
375
return protectivelyWrapAndSubscribe (new Observer () {
367
376
377
+ @ Override
368
378
public void onCompleted () {
369
379
// do nothing
370
380
}
371
381
382
+ @ Override
372
383
public void onError (Exception e ) {
373
384
handleError (e );
374
385
if (onError != null ) {
375
386
Functions .from (onError ).call (e );
376
387
}
377
388
}
378
389
390
+ @ Override
379
391
public void onNext (Object args ) {
380
392
onNextFunction .call (args );
381
393
}
@@ -396,17 +408,20 @@ public Subscription subscribe(final Action1<T> onNext, final Action1<Exception>
396
408
*/
397
409
return protectivelyWrapAndSubscribe (new Observer <T >() {
398
410
411
+ @ Override
399
412
public void onCompleted () {
400
413
// do nothing
401
414
}
402
415
416
+ @ Override
403
417
public void onError (Exception e ) {
404
418
handleError (e );
405
419
if (onError != null ) {
406
420
onError .call (e );
407
421
}
408
422
}
409
423
424
+ @ Override
410
425
public void onNext (T args ) {
411
426
if (onNext == null ) {
412
427
throw new RuntimeException ("onNext must be implemented" );
@@ -436,19 +451,22 @@ public Subscription subscribe(final Object onNext, final Object onError, final O
436
451
*/
437
452
return protectivelyWrapAndSubscribe (new Observer () {
438
453
454
+ @ Override
439
455
public void onCompleted () {
440
456
if (onComplete != null ) {
441
457
Functions .from (onComplete ).call ();
442
458
}
443
459
}
444
460
461
+ @ Override
445
462
public void onError (Exception e ) {
446
463
handleError (e );
447
464
if (onError != null ) {
448
465
Functions .from (onError ).call (e );
449
466
}
450
467
}
451
468
469
+ @ Override
452
470
public void onNext (Object args ) {
453
471
onNextFunction .call (args );
454
472
}
@@ -469,17 +487,20 @@ public Subscription subscribe(final Action1<T> onNext, final Action1<Exception>
469
487
*/
470
488
return protectivelyWrapAndSubscribe (new Observer <T >() {
471
489
490
+ @ Override
472
491
public void onCompleted () {
473
492
onComplete .call ();
474
493
}
475
494
495
+ @ Override
476
496
public void onError (Exception e ) {
477
497
handleError (e );
478
498
if (onError != null ) {
479
499
onError .call (e );
480
500
}
481
501
}
482
502
503
+ @ Override
483
504
public void onNext (T args ) {
484
505
if (onNext == null ) {
485
506
throw new RuntimeException ("onNext must be implemented" );
@@ -516,10 +537,12 @@ public void forEach(final Action1<T> onNext) {
516
537
* See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator"
517
538
*/
518
539
protectivelyWrapAndSubscribe (new Observer <T >() {
540
+ @ Override
519
541
public void onCompleted () {
520
542
latch .countDown ();
521
543
}
522
544
545
+ @ Override
523
546
public void onError (Exception e ) {
524
547
/*
525
548
* If we receive an onError event we set the reference on the outer thread
@@ -531,6 +554,7 @@ public void onError(Exception e) {
531
554
latch .countDown ();
532
555
}
533
556
557
+ @ Override
534
558
public void onNext (T args ) {
535
559
onNext .call (args );
536
560
}
@@ -582,6 +606,7 @@ public void forEach(final Object o) {
582
606
583
607
forEach (new Action1 () {
584
608
609
+ @ Override
585
610
public void call (Object args ) {
586
611
onNext .call (args );
587
612
}
@@ -1846,6 +1871,8 @@ public T call(T t1, T t2) {
1846
1871
*
1847
1872
* @param <T>
1848
1873
* the type item emitted by the source Observable
1874
+ * @param <R>
1875
+ * the type returned for each item of the target observable
1849
1876
* @param sequence
1850
1877
* the source Observable
1851
1878
* @param initialValue
@@ -1857,7 +1884,7 @@ public T call(T t1, T t2) {
1857
1884
* output from the sequence emitted by the source Observable
1858
1885
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211665(v%3Dvs.103).aspx">MSDN: Observable.Scan</a>
1859
1886
*/
1860
- public static <T > Observable <T > scan (Observable <T > sequence , T initialValue , Func2 <T , T , T > accumulator ) {
1887
+ public static <T , R > Observable <R > scan (Observable <T > sequence , R initialValue , Func2 <R , T , R > accumulator ) {
1861
1888
return create (OperationScan .scan (sequence , initialValue , accumulator ));
1862
1889
}
1863
1890
@@ -1871,6 +1898,8 @@ public static <T> Observable<T> scan(Observable<T> sequence, T initialValue, Fun
1871
1898
*
1872
1899
* @param <T>
1873
1900
* the type item emitted by the source Observable
1901
+ * @param <R>
1902
+ * the type returned for each item of the target observable
1874
1903
* @param sequence
1875
1904
* the source Observable
1876
1905
* @param initialValue
@@ -1882,17 +1911,16 @@ public static <T> Observable<T> scan(Observable<T> sequence, T initialValue, Fun
1882
1911
* output from the sequence emitted by the source Observable
1883
1912
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211665(v%3Dvs.103).aspx">MSDN: Observable.Scan</a>
1884
1913
*/
1885
- public static <T > Observable <T > scan (final Observable <T > sequence , final T initialValue , final Object accumulator ) {
1914
+ public static <T , R > Observable <R > scan (final Observable <T > sequence , final R initialValue , final Object accumulator ) {
1886
1915
@ SuppressWarnings ("rawtypes" )
1887
1916
final FuncN _f = Functions .from (accumulator );
1888
- return scan (sequence , initialValue , new Func2 <T , T , T >() {
1917
+ return scan (sequence , initialValue , new Func2 <R , T , R >() {
1889
1918
1890
1919
@ SuppressWarnings ("unchecked" )
1891
1920
@ Override
1892
- public T call (T t1 , T t2 ) {
1893
- return (T ) _f .call (t1 , t2 );
1921
+ public R call (R r , T t ) {
1922
+ return (R ) _f .call (r , t );
1894
1923
}
1895
-
1896
1924
});
1897
1925
}
1898
1926
@@ -2743,6 +2771,7 @@ public Observable<T> filter(final Object callback) {
2743
2771
final FuncN _f = Functions .from (callback );
2744
2772
return filter (this , new Func1 <T , Boolean >() {
2745
2773
2774
+ @ Override
2746
2775
public Boolean call (T t1 ) {
2747
2776
return (Boolean ) _f .call (t1 );
2748
2777
}
@@ -2913,6 +2942,7 @@ public <R> Observable<R> map(final Object callback) {
2913
2942
final FuncN _f = Functions .from (callback );
2914
2943
return map (this , new Func1 <T , R >() {
2915
2944
2945
+ @ Override
2916
2946
@ SuppressWarnings ("unchecked" )
2917
2947
public R call (T t1 ) {
2918
2948
return (R ) _f .call (t1 );
@@ -2963,6 +2993,7 @@ public <R> Observable<R> mapMany(final Object callback) {
2963
2993
final FuncN _f = Functions .from (callback );
2964
2994
return mapMany (this , new Func1 <T , Observable <R >>() {
2965
2995
2996
+ @ Override
2966
2997
@ SuppressWarnings ("unchecked" )
2967
2998
public Observable <R > call (T t1 ) {
2968
2999
return (Observable <R >) _f .call (t1 );
@@ -3071,6 +3102,7 @@ public Observable<T> onErrorResumeNext(final Object resumeFunction) {
3071
3102
final FuncN _f = Functions .from (resumeFunction );
3072
3103
return onErrorResumeNext (this , new Func1 <Exception , Observable <T >>() {
3073
3104
3105
+ @ Override
3074
3106
@ SuppressWarnings ("unchecked" )
3075
3107
public Observable <T > call (Exception e ) {
3076
3108
return (Observable <T >) _f .call (e );
@@ -3152,6 +3184,7 @@ public Observable<T> onErrorReturn(final Object resumeFunction) {
3152
3184
final FuncN _f = Functions .from (resumeFunction );
3153
3185
return onErrorReturn (this , new Func1 <Exception , T >() {
3154
3186
3187
+ @ Override
3155
3188
@ SuppressWarnings ("unchecked" )
3156
3189
public T call (Exception e ) {
3157
3190
return (T ) _f .call (e );
@@ -3330,7 +3363,7 @@ public Observable<T> scan(final Object accumulator) {
3330
3363
* the list of Observables.
3331
3364
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211665(v%3Dvs.103).aspx">MSDN: Observable.Scan</a>
3332
3365
*/
3333
- public Observable <T > scan (T initialValue , Func2 <T , T , T > accumulator ) {
3366
+ public < R > Observable <R > scan (R initialValue , Func2 <R , T , R > accumulator ) {
3334
3367
return scan (this , initialValue , accumulator );
3335
3368
}
3336
3369
@@ -3353,7 +3386,7 @@ public Observable<T> scan(T initialValue, Func2<T, T, T> accumulator) {
3353
3386
* the list of Observables.
3354
3387
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211665(v%3Dvs.103).aspx">MSDN: Observable.Scan</a>
3355
3388
*/
3356
- public Observable <T > scan (final T initialValue , final Object accumulator ) {
3389
+ public < R > Observable <R > scan (final R initialValue , final Object accumulator ) {
3357
3390
return scan (this , initialValue , accumulator );
3358
3391
}
3359
3392
0 commit comments