Skip to content

Observable.scan() overload to take a factory for initial value? #3667

@NiteshKant

Description

@NiteshKant

Currently the scan operator has an overload to take an initial value for the accumulation. The problem with this is that the initial value is the same for all subscribers of this observable, which hardly is intended by the user. It is actually a source of subtle bugs for a casual user.

I think there should atleast be an overload that instead of the realized initial value takes a factory for the initial value for each subscription. The underlying OperatorScan already supports an initial value factory.

I would also suggest to either deprecate the current scan() method or if it is usable in some cases, atleast put a warning in the javadoc.

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