Skip to content

Flowable.fromIterable does not work as expected when used in switchMap #6615

@adrian-linca

Description

@adrian-linca

This issue was reproduces on RX-Java v2.2.6 and v3.0.0-RC1

I have this piece of code:

Flowable
  .range(1, 2)
  .doOnNext(value -> {
    System.out.println("value1: " + value);
  })
  .switchMap(value -> Flowable.just(value * 10))
  .subscribe(
    value -> System.out.println("value2: " + value),
    throwable -> System.out.println("error: " + throwable),
    () -> System.out.println("complete")
   );

When run it prints:
value1: 1
value2: 10
value1: 2
value2: 20
complete

Then I have the exact same thing but with Flowable.fromIterable:

Flowable
    .range(1, 2)
    .doOnNext(value -> {
        System.out.println("value1: " + value);
    })
    .switchMap(value -> Flowable.fromIterable(Arrays.asList(value * 10)))
    .subscribe(
        value -> System.out.println("value2: " + value),
        throwable -> System.out.println("error: " + throwable),
        () -> System.out.println("complete")
    );

This one prints:
value1: 1
value2: 10

And then nothing, no complete, no error, nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions