42
42
import rx .operators .OperationConcat ;
43
43
import rx .operators .OperationDefer ;
44
44
import rx .operators .OperationDematerialize ;
45
- import rx .operators .OperationGroupBy ;
46
45
import rx .operators .OperationFilter ;
47
46
import rx .operators .OperationFinally ;
47
+ import rx .operators .OperationGroupBy ;
48
48
import rx .operators .OperationMap ;
49
49
import rx .operators .OperationMaterialize ;
50
50
import rx .operators .OperationMerge ;
@@ -590,9 +590,11 @@ public void call(Object args) {
590
590
591
591
/**
592
592
* Returns a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.
593
- *
594
- * @param subject the subject to push source elements into.
595
- * @param <R> result type
593
+ *
594
+ * @param subject
595
+ * the subject to push source elements into.
596
+ * @param <R>
597
+ * result type
596
598
* @return a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.
597
599
*/
598
600
public <R > ConnectableObservable <R > multicast (Subject <T , R > subject ) {
@@ -1172,6 +1174,8 @@ public R call(T t1) {
1172
1174
* and then merges the results of that function applied to every item emitted by the original
1173
1175
* Observable, emitting these merged results as its own sequence.
1174
1176
* <p>
1177
+ * Note: mapMany and flatMap are equivalent.
1178
+ * <p>
1175
1179
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
1176
1180
*
1177
1181
* @param sequence
@@ -1186,6 +1190,7 @@ public R call(T t1) {
1186
1190
* @return an Observable that emits a sequence that is the result of applying the transformation
1187
1191
* function to each item emitted by the source Observable and merging the results of
1188
1192
* the Observables obtained from this transformation
1193
+ * @see {@link #flatMap(Observable, Func1)}
1189
1194
*/
1190
1195
public static <T , R > Observable <R > mapMany (Observable <T > sequence , Func1 <T , Observable <R >> func ) {
1191
1196
return create (OperationMap .mapMany (sequence , func ));
@@ -1351,6 +1356,62 @@ public static <T> Observable<T> finallyDo(Observable<T> source, Action0 action)
1351
1356
return create (OperationFinally .finallyDo (source , action ));
1352
1357
}
1353
1358
1359
+ /**
1360
+ * Creates a new Observable sequence by applying a function that you supply to each object in the
1361
+ * original Observable sequence, where that function is itself an Observable that emits objects,
1362
+ * and then merges the results of that function applied to every item emitted by the original
1363
+ * Observable, emitting these merged results as its own sequence.
1364
+ * <p>
1365
+ * Note: mapMany and flatMap are equivalent.
1366
+ * <p>
1367
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
1368
+ *
1369
+ * @param sequence
1370
+ * the source Observable
1371
+ * @param func
1372
+ * a function to apply to each item emitted by the source Observable, generating a
1373
+ * Observable
1374
+ * @param <T>
1375
+ * the type emitted by the source Observable
1376
+ * @param <R>
1377
+ * the type emitted by the Observables emitted by <code>func</code>
1378
+ * @return an Observable that emits a sequence that is the result of applying the transformation
1379
+ * function to each item emitted by the source Observable and merging the results of
1380
+ * the Observables obtained from this transformation
1381
+ * @see {@link #mapMany(Observable, Func1)}
1382
+ */
1383
+ public static <T , R > Observable <R > flatMap (Observable <T > sequence , Func1 <T , Observable <R >> func ) {
1384
+ return mapMany (sequence , func );
1385
+ }
1386
+
1387
+ /**
1388
+ * Creates a new Observable sequence by applying a function that you supply to each object in the
1389
+ * original Observable sequence, where that function is itself an Observable that emits objects,
1390
+ * and then merges the results of that function applied to every item emitted by the original
1391
+ * Observable, emitting these merged results as its own sequence.
1392
+ * <p>
1393
+ * Note: mapMany and flatMap are equivalent.
1394
+ * <p>
1395
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
1396
+ *
1397
+ * @param sequence
1398
+ * the source Observable
1399
+ * @param func
1400
+ * a function to apply to each item emitted by the source Observable, generating a
1401
+ * Observable
1402
+ * @param <T>
1403
+ * the type emitted by the source Observable
1404
+ * @param <R>
1405
+ * the type emitted by the Observables emitted by <code>func</code>
1406
+ * @return an Observable that emits a sequence that is the result of applying the transformation
1407
+ * function to each item emitted by the source Observable and merging the results of
1408
+ * the Observables obtained from this transformation
1409
+ * @see {@link #mapMany(Observable, Func1)}
1410
+ */
1411
+ public static <T , R > Observable <R > flatMap (Observable <T > sequence , final Object func ) {
1412
+ return mapMany (sequence , func );
1413
+ }
1414
+
1354
1415
/**
1355
1416
* Groups the elements of an observable and selects the resulting elements by using a specified function.
1356
1417
*
@@ -2088,11 +2149,15 @@ public static <T> Iterable<T> mostRecent(Observable<T> source, T initialValue) {
2088
2149
2089
2150
/**
2090
2151
* Returns a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.
2091
- *
2092
- * @param source the source sequence whose elements will be pushed into the specified subject.
2093
- * @param subject the subject to push source elements into.
2094
- * @param <T> source type
2095
- * @param <R> result type
2152
+ *
2153
+ * @param source
2154
+ * the source sequence whose elements will be pushed into the specified subject.
2155
+ * @param subject
2156
+ * the subject to push source elements into.
2157
+ * @param <T>
2158
+ * source type
2159
+ * @param <R>
2160
+ * result type
2096
2161
* @return a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.
2097
2162
*/
2098
2163
public static <T , R > ConnectableObservable <R > multicast (Observable <T > source , final Subject <T , R > subject ) {
@@ -2101,7 +2166,7 @@ public static <T, R> ConnectableObservable<R> multicast(Observable<T> source, fi
2101
2166
2102
2167
/**
2103
2168
* Returns the only element of an observable sequence and throws an exception if there is not exactly one element in the observable sequence.
2104
- *
2169
+ *
2105
2170
* @param that
2106
2171
* the source Observable
2107
2172
* @return The single element in the observable sequence.
@@ -2670,6 +2735,48 @@ public Boolean call(T t1) {
2670
2735
});
2671
2736
}
2672
2737
2738
+ /**
2739
+ * Creates a new Observable sequence by applying a function that you supply to each item in the
2740
+ * original Observable sequence, where that function is itself an Observable that emits items, and
2741
+ * then merges the results of that function applied to every item emitted by the original
2742
+ * Observable, emitting these merged results as its own sequence.
2743
+ * <p>
2744
+ * Note: mapMany and flatMap are equivalent.
2745
+ * <p>
2746
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
2747
+ *
2748
+ * @param func
2749
+ * a function to apply to each item in the sequence, that returns an Observable.
2750
+ * @return an Observable that emits a sequence that is the result of applying the transformation
2751
+ * function to each item in the input sequence and merging the results of the
2752
+ * Observables obtained from this transformation.
2753
+ * @see {@link #mapMany(Func1)}
2754
+ */
2755
+ public <R > Observable <R > flatMap (Func1 <T , Observable <R >> func ) {
2756
+ return mapMany (func );
2757
+ }
2758
+
2759
+ /**
2760
+ * Creates a new Observable sequence by applying a function that you supply to each item in the
2761
+ * original Observable sequence, where that function is itself an Observable that emits items, and
2762
+ * then merges the results of that function applied to every item emitted by the original
2763
+ * Observable, emitting these merged results as its own sequence.
2764
+ * <p>
2765
+ * Note: mapMany and flatMap are equivalent.
2766
+ * <p>
2767
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
2768
+ *
2769
+ * @param callback
2770
+ * a function to apply to each item in the sequence that returns an Observable.
2771
+ * @return an Observable that emits a sequence that is the result of applying the transformation'
2772
+ * function to each item in the input sequence and merging the results of the
2773
+ * Observables obtained from this transformation.
2774
+ * @see {@link #mapMany(Object)}
2775
+ */
2776
+ public <R > Observable <R > flatMap (final Object callback ) {
2777
+ return mapMany (callback );
2778
+ }
2779
+
2673
2780
/**
2674
2781
* Filters an Observable by discarding any of its emissions that do not meet some test.
2675
2782
* <p>
@@ -2805,13 +2912,16 @@ public R call(T t1) {
2805
2912
* then merges the results of that function applied to every item emitted by the original
2806
2913
* Observable, emitting these merged results as its own sequence.
2807
2914
* <p>
2915
+ * Note: mapMany and flatMap are equivalent.
2916
+ * <p>
2808
2917
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
2809
2918
*
2810
2919
* @param func
2811
2920
* a function to apply to each item in the sequence, that returns an Observable.
2812
2921
* @return an Observable that emits a sequence that is the result of applying the transformation
2813
2922
* function to each item in the input sequence and merging the results of the
2814
2923
* Observables obtained from this transformation.
2924
+ * @see {@link #flatMap(Func1)}
2815
2925
*/
2816
2926
public <R > Observable <R > mapMany (Func1 <T , Observable <R >> func ) {
2817
2927
return mapMany (this , func );
@@ -2823,13 +2933,16 @@ public <R> Observable<R> mapMany(Func1<T, Observable<R>> func) {
2823
2933
* then merges the results of that function applied to every item emitted by the original
2824
2934
* Observable, emitting these merged results as its own sequence.
2825
2935
* <p>
2936
+ * Note: mapMany and flatMap are equivalent.
2937
+ * <p>
2826
2938
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
2827
2939
*
2828
2940
* @param callback
2829
2941
* a function to apply to each item in the sequence that returns an Observable.
2830
2942
* @return an Observable that emits a sequence that is the result of applying the transformation'
2831
2943
* function to each item in the input sequence and merging the results of the
2832
2944
* Observables obtained from this transformation.
2945
+ * @see {@link #flatMap(Object))}
2833
2946
*/
2834
2947
public <R > Observable <R > mapMany (final Object callback ) {
2835
2948
@ SuppressWarnings ("rawtypes" )
0 commit comments