I tried to convert Observable<List<A>>
to Flowable<A>
in RxJava, however it doesn't work.
return resource.flatMap(
new Function<Observable<List<Product>>, List<Product>>() {
@Override
public List<Product> apply(Observable<List<Product>> products) throws Exception {
return (List<Product>) products;
}
}).toFlowable(BackpressureStrategy.BUFFER)
You need flatMapIterable
:
return resource.flatMapIterable(list -> list)
.toFlowable(BackpressureStrategy.BUFFER)