如何从 Observable<List<Type>> 创建 Observable<Type>

How to create an Observable<Type> from an Observable<List<Type>>

如果我有 ObservableListLetters

public Observable<List<Letter>> getAToZList() {
        return Observable.create(
                new Observable.OnSubscribe<List<Letter>>() {
                    @Override
                    public void call(Subscriber<? super List<Letter>> subscriber) {
                        List<Letter> aToZLetters = getLetters();
                        subscriber.onNext(aToZLetters);
                        subscriber.onCompleted();
                    }
                }
        );
    }

然后我如何创建一个 Observable 来观察单个 Letter 并为 List 中的每个发出一个?

public Observable<Letter> getAToZ() {
        return Observable.create(
                     getAToZList().something() ??
        );
    }

https://github.com/ReactiveX/RxJava

使用flatMapIterable。例如:

observable.flatMapIterable(l -> l).subscribe()