Skip to content

Examine the possibility to replace Stream<X> with BaseStream<X, ?> in method parameters #76

@amaembo

Description

@amaembo

It's possible to change some StreamEx method signatures to avoid explicit boxing call for parameter:

append(Stream<? extends T>) -> append(BaseStream<? extends T, ?>)
prepend(Stream<? extends T>) -> prepend(BaseStream<? extends T, ?>)

[Implemented] zipWith(Stream<V>[, BiFunction]) -> zipWith(BaseStream<V, ?>[, BiFunction])

headTail(BiFunction<? super T, ? super StreamEx<T>, ? extends Stream<R>>) ->
    headTail(BiFunction<? super T, ? super StreamEx<T>, ? extends BaseStream<R, ?>>)
headTail(BiFunction<? super T, ? super StreamEx<T>, ? extends Stream<R>> mapper,
        Supplier<? extends Stream<R>> supplier) ->
    headTail(BiFunction<? super T, ? super StreamEx<T>, ? extends BaseStream<R, ?>> mapper,
            Supplier<? extends BaseStream<R, ?>> supplier)

Also MoreCollectors method:

flatMapping(Function<? super T, ? extends Stream<? extends U>> mapper
        [, Collector<? super U, A, R> downstream]) ->
    flatMapping(Function<? super T, ? extends BaseStream<? extends U, ?>> mapper
            [, Collector<? super U, A, R> downstream])

This change will allow to skip .boxed() call in some cases. E.g.:

StreamEx.of("a", "b", "c").zipWith(IntStreamEx.ints())...

This change breaks binary compatibility (recompilation will be necessary), so cannot be introduced in patch release.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions