Skip to content
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

Remove deprecated methods for next major release #777

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 0 additions & 128 deletions src/main/java/com/pivovarit/collectors/ParallelCollectors.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,6 @@ public final class ParallelCollectors {
private ParallelCollectors() {
}

/**
* A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
* and returning them as a {@link CompletableFuture} containing a result of the application of the user-provided {@link Collector}.
*
* <br><br>
* The maximum parallelism level defaults to {@code Runtime.availableProcessors() - 1}
*
* <br>
* Example:
* <pre>{@code
* CompletableFuture<List<String>> result = Stream.of(1, 2, 3)
* .collect(parallel(i -> foo(i), toList(), executor));
* }</pre>
*
* @param mapper a transformation to be performed in parallel
* @param collector the {@code Collector} describing the reduction
* @param executor the {@code Executor} to use for asynchronous execution
* @param <T> the type of the collected elements
* @param <R> the result returned by {@code mapper}
* @param <RR> the reduction result {@code collector}
*
* @return a {@code Collector} which collects all processed elements into a user-provided mutable {@code Collection} in parallel
*
* @since 2.0.0
* @deprecated use {@link ParallelCollectors#parallel(Function, Collector, Executor, int)}
*/
public static <T, R, RR> Collector<T, ?, CompletableFuture<RR>> parallel(Function<T, R> mapper, Collector<R, ?, RR> collector, Executor executor) {
return AsyncParallelCollector.collectingWithCollector(collector, mapper, executor);
}

/**
* A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
* and returning them as a {@link CompletableFuture} containing a result of the application of the user-provided {@link Collector}.
Expand Down Expand Up @@ -74,37 +44,6 @@ private ParallelCollectors() {
return AsyncParallelCollector.collectingWithCollector(collector, mapper, executor, parallelism);
}

/**
* A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
* and returning them as {@link CompletableFuture} containing a {@link Stream} of these elements
*
* <br><br>
* The max parallelism level defaults to {@code Runtime.availableProcessors() - 1} but not less than 4
*
* <br><br>
* The collector maintains the order of processed {@link Stream}. Instances should not be reused.
*
* <br>
* Example:
* <pre>{@code
* CompletableFuture<Stream<String>> result = Stream.of(1, 2, 3)
* .collect(parallel(i -> foo(), executor));
* }</pre>
*
* @param mapper a transformation to be performed in parallel
* @param executor the {@code Executor} to use for asynchronous execution
* @param <T> the type of the collected elements
* @param <R> the result returned by {@code mapper}
*
* @return a {@code Collector} which collects all processed elements into a {@code Stream} in parallel
*
* @since 2.0.0
* @deprecated use {@link ParallelCollectors#parallel(Function, Executor, int)}
*/
public static <T, R> Collector<T, ?, CompletableFuture<Stream<R>>> parallel(Function<T, R> mapper, Executor executor) {
return AsyncParallelCollector.collectingToStream(mapper, executor);
}

/**
* A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
* and returning them as {@link CompletableFuture} containing a {@link Stream} of these elements.
Expand Down Expand Up @@ -133,40 +72,6 @@ private ParallelCollectors() {
return AsyncParallelCollector.collectingToStream(mapper, executor, parallelism);
}

/**
* A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
* and returning a {@link Stream} instance returning results in completion order
* <p>
* For the parallelism of 1, the stream is executed by the calling thread.
*
* <br><br>
* The max parallelism level defaults to {@code Runtime.availableProcessors() - 1} but not less than 4
*
* <br><br>
* Instances should not be reused.
*
* <br>
* Example:
* <pre>{@code
* List<String> result = Stream.of(1, 2, 3)
* .collect(parallelToStream(i -> foo(), executor))
* .collect(toList());
* }</pre>
*
* @param mapper a transformation to be performed in parallel
* @param executor the {@code Executor} to use for asynchronous execution
* @param <T> the type of the collected elements
* @param <R> the result returned by {@code mapper}
*
* @return a {@code Collector} which collects all processed elements into a {@code Stream} in parallel
*
* @since 2.0.0
* @deprecated use {@link ParallelCollectors#parallelToStream(Function, Executor, int)}
*/
public static <T, R> Collector<T, ?, Stream<R>> parallelToStream(Function<T, R> mapper, Executor executor) {
return ParallelStreamCollector.streaming(mapper, executor);
}

/**
* A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
* and returning a {@link Stream} instance returning results as they arrive.
Expand Down Expand Up @@ -195,39 +100,6 @@ private ParallelCollectors() {
return ParallelStreamCollector.streaming(mapper, executor, parallelism);
}

/**
* A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
* and returning a {@link Stream} instance returning results as they arrive while maintaining the initial order.
* <p>
* For the parallelism of 1, the stream is executed by the calling thread.
*
* <br><br>
* The max parallelism level defaults to {@code Runtime.availableProcessors() - 1} but not less than 4
*
* <br><br>
* Instances should not be reused.
* <br><br>
* Example:
* <pre>{@code
* Stream.of(1, 2, 3)
* .collect(parallelToOrderedStream(i -> foo(), executor))
* .forEach(System.out::println);
* }</pre>
*
* @param mapper a transformation to be performed in parallel
* @param executor the {@code Executor} to use for asynchronous execution
* @param <T> the type of the collected elements
* @param <R> the result returned by {@code mapper}
*
* @return a {@code Collector} which collects all processed elements into a {@code Stream} in parallel
*
* @since 2.0.0
* @deprecated use {@link ParallelCollectors#parallelToOrderedStream(Function, Executor, int)}
*/
public static <T, R> Collector<T, ?, Stream<R>> parallelToOrderedStream(Function<T, R> mapper, Executor executor) {
return ParallelStreamCollector.streamingOrdered(mapper, executor);
}

/**
* A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
* and returning a {@link Stream} instance returning results as they arrive while maintaining the initial order.
Expand Down