Skip to content

Commit

Permalink
Improve internal naming (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
pivovarit authored Oct 12, 2023
1 parent c48c915 commit 7d7cb18
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ final class AsyncParallelCollector<T, R, C>
implements Collector<T, List<CompletableFuture<R>>, CompletableFuture<C>> {

private final Dispatcher<R> dispatcher;
private final Function<T, R> mapper;
private final Function<Stream<R>, C> processor;
private final Function<T, R> task;
private final Function<Stream<R>, C> finalizer;

private AsyncParallelCollector(
Function<T, R> mapper,
Function<T, R> task,
Dispatcher<R> dispatcher,
Function<Stream<R>, C> processor) {
Function<Stream<R>, C> finalizer) {
this.dispatcher = dispatcher;
this.processor = processor;
this.mapper = mapper;
this.finalizer = finalizer;
this.task = task;
}

@Override
Expand All @@ -55,12 +55,12 @@ public BinaryOperator<List<CompletableFuture<R>>> combiner() {

@Override
public BiConsumer<List<CompletableFuture<R>>, T> accumulator() {
return (acc, e) -> acc.add(dispatcher.enqueue(() -> mapper.apply(e)));
return (acc, e) -> acc.add(dispatcher.enqueue(() -> task.apply(e)));
}

@Override
public Function<List<CompletableFuture<R>>, CompletableFuture<C>> finisher() {
return futures -> combine(futures).thenApply(processor);
return futures -> combine(futures).thenApply(finalizer);
}

@Override
Expand Down

0 comments on commit 7d7cb18

Please sign in to comment.