Skip to content

3.x Consider making .collect contravariant on T #7032

@cardamon

Description

@cardamon

Hi,

Currently, collect in Flowable, Observable accepts a Collector<T, A, R> collector. If that were to be Collector<? super T, A, R> collector, less casting would be needed in some instances. For example, when using java.util.stream.Collectors.joining():

Observable .just("foo", "bar", "baz") .cast(CharSequence.class) .collect(joining(", "));

The .cast(CharSequence.class) would then no longer be needed.

Should also be binary compatible?

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