-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collect Operator #701
Collect Operator #701
Conversation
RxJava-pull-requests #618 SUCCESS |
Not exactly how Stream works: <R> R collect(Supplier<R> supplier,
BiConsumer<R, ? super T> accumulator,
BiConsumer<R, R> combiner); and <R, A> R collect(Collector<? super T, A, R> collector); where public interface Collector<T, A, R> {
Supplier<A> supplier();
BiConsumer<A, T> accumulator();
BinaryOperator<A> combiner();
Function<A, R> finisher();
} The main difference is that, the Steam and my version "exits" the stream/observable. The second is that it doesn't let the initial state be per subscriber. So if I want to collect into an ArrayList, multiple subscribers will collect into the same ArrayList. |
The |
Understood. It's not meant to. Stream is seeking to achieve something that works in both sequential and parallel execution, The The valid discussion would be whether we want |
What dependency problems? |
That's true, but these are used to transfer values which are "stateless" such as Integer and Double. Of course, one could just create a new ArrayList in reduce on each function call and be that the new state, but this
I wasn't referring to the parallel capability of the stream but to two things:
Dependency problem: a reference to jUnit in Observable?
|
Added with @headinthebox while reviewing Java 8 Streams #678