Skip to content

flatMapIterable and toList combination issue #3716

@httpdispatch

Description

@httpdispatch

In the following code the "three" and "done" never appears in the output. Looks like the problem is in toList call. Am i using it wrong?

PublishSubject<Boolean> mBooleanPublishSubject = PublishSubject.create();
Observable<Boolean> observable = mBooleanPublishSubject.asObservable().share();
observable
        .doOnNext(__ -> System.out.println("one"))
        .flatMap(__ -> Observable.just(Arrays.asList(1, 2, 3, 4)))
        .flatMapIterable(number -> number)
        .doOnNext(v -> System.out.println("two " + v))
        .toList()
        .doOnNext(v -> System.out.println("three " + v))
        .subscribe(v -> System.out.println("done"));
mBooleanPublishSubject.onNext(true);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions