Skip to content

2.0.9 possible bug with Maybe.switchIfEmpty  #5375

@mjurkus

Description

@mjurkus

So, not sure if it's a bug or am I not using the operator right.

Maybe.empty<Int>()
        .switchIfEmpty { Maybe.just(2) }
        .subscribe {
            println("got $it")
        }

Block above completes without any results as if Maybe is empty. While block below completes successfully with got 2 output.

Maybe.empty<Int>()
        .switchIfEmpty(Maybe.just(2))
        .subscribe {
            println("got $it")
        }

From documentation I expect, that both cases should work the same.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions