Skip to content

Sequences.withEffect() doesn't work well with LimitedSequence and probably some other kinds of Sequences #3849

@leventov

Description

@leventov
Sequences.limit(Sequences.withEffect(Sequences.simple(Arrays.asList(1, 2, 3)), ...), 3)

doesn't execute the effect. It looks like a bug to me. I don't see how it could be fixed with the current Yielder's API: isDone(), next(), and close(). Fixing the API would be a massive change, and I don't want to risk doing this change and rewrite very convoluted logic of Combining, Merging, Filtered, Limited Sequences.

FYI RxJava which has Flowable, the abstraction very similar to Sequence, uses Publisher/Subscriber model instead of "external" model like Yielder. Probably pub/sub allows to avoid such issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions