본문
180315(목) - RxJava2 (concatMap)
Mobile/RxJava2 2018. 3. 15. 13:23
RxJava2
concatMap
transform the items emitted by an Observable into Observables, then flatten the emissions from those into a single Observable
concatMap
@CheckReturnValue @BackpressureSupport(value=FULL) @SchedulerSupport(value="none") public final <R> Flowable<R> concatMap(Function<? super T,? extends Publisher<? extends R>> mapper)
Returns a new Flowable that emits items resulting from applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then emitting the items that result from concatenating those resulting Publishers.
- Backpressure:
- The operator honors backpressure from downstream. Both this and the inner
Publisher
s are expected to honor backpressure as well. If the sourcePublisher
violates the rule, the operator will signal aMissingBackpressureException
. If any of the innerPublisher
s doesn't honor backpressure, that may throw anIllegalStateException
when thatPublisher
completes. - Scheduler:
concatMap
does not operate by default on a particularScheduler
.
- Type Parameters:
R
- the type of the inner Publisher sources and thus the output type- Parameters:
mapper
- a function that, when applied to an item emitted by the source Publisher, returns an Publisher- Returns:
- a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and concatenating the Publishers obtained from this transformation
- See Also:
- ReactiveX operators documentation: FlatMap
concatMap
@CheckReturnValue @BackpressureSupport(value=FULL) @SchedulerSupport(value="none") public final <R> Flowable<R> concatMap(Function<? super T,? extends Publisher<? extends R>> mapper, int prefetch)
Returns a new Flowable that emits items resulting from applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then emitting the items that result from concatenating those resulting Publishers.
- Backpressure:
- The operator honors backpressure from downstream. Both this and the inner
Publisher
s are expected to honor backpressure as well. If the sourcePublisher
violates the rule, the operator will signal aMissingBackpressureException
. If any of the innerPublisher
s doesn't honor backpressure, that may throw anIllegalStateException
when thatPublisher
completes. - Scheduler:
concatMap
does not operate by default on a particularScheduler
.
- Type Parameters:
R
- the type of the inner Publisher sources and thus the output type- Parameters:
mapper
- a function that, when applied to an item emitted by the source Publisher, returns an Publisherprefetch
- the number of elements to prefetch from the current Flowable- Returns:
- a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and concatenating the Publishers obtained from this transformation
- See Also:
- ReactiveX operators documentation: FlatMap
'Mobile > RxJava2' 카테고리의 다른 글
180107(수) - RxJava2 (buffer) (0) | 2018.02.07 |
---|---|
180206(화) - RxJava2 (timer) (0) | 2018.02.06 |
180205(월) - RxJava2 (start) (0) | 2018.02.05 |
180104(목) - RxJava2 (repeat) (0) | 2018.01.04 |
180103(수) - RxJava2 (range) (0) | 2018.01.03 |
댓글