public class ParallelSort
extends java.lang.Object
Constructor and Description |
---|
ParallelSort() |
Modifier and Type | Method and Description |
---|---|
static <T> void |
sort(java.util.List<T> list,
java.util.Comparator<? super T> comparator,
java.util.concurrent.ThreadPoolExecutor executor,
int minDivisionSize)
Sort a list by a given comparator using multiple threads.
|
static <T> void |
sort(java.util.List<T> list,
java.util.Comparator<? super T> comparator,
java.util.concurrent.ThreadPoolExecutor executor,
int maxThreads,
int minDivisionSize)
Sort a list by a given comparator using multiple threads.
|
static <T extends java.lang.Comparable<T>> |
sort(java.util.List<T> list,
java.util.concurrent.ThreadPoolExecutor executor,
int minDivisionSize)
Sort a list of comparable items in their natural order using multiple threads.
|
static <T extends java.lang.Comparable<T>> |
sort(java.util.List<T> list,
java.util.concurrent.ThreadPoolExecutor executor,
int maxThreads,
int minDivisionSize)
Sort a list of comparable items in their natural order using multiple threads.
|
public static <T extends java.lang.Comparable<T>> void sort(@NotNull java.util.List<T> list, @NotNull java.util.concurrent.ThreadPoolExecutor executor, int minDivisionSize) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
T
- list typelist
- list to sort. Doas not need to be threadsafe unless it is also changed o
concurrently outside of this method.executor
- thread pool executor for parallel sort tasksminDivisionSize
- minimal size of a sublist before standard standard sorting is usedjava.util.concurrent.ExecutionException
- on executor errorsjava.lang.InterruptedException
- if execution was interruptedpublic static <T extends java.lang.Comparable<T>> void sort(@NotNull java.util.List<T> list, @NotNull java.util.concurrent.ThreadPoolExecutor executor, int maxThreads, int minDivisionSize) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
T
- list typelist
- list to sort. Doas not need to be threadsafe unless it is also changed o
concurrently outside of this method.executor
- thread pool executor for parallel sort tasksmaxThreads
- maximum number of parallel sort threadsminDivisionSize
- minimal size of a sublist before standard standard sorting is usedjava.util.concurrent.ExecutionException
- on executor errorsjava.lang.InterruptedException
- if execution was interruptedpublic static <T> void sort(@NotNull java.util.List<T> list, @NotNull java.util.Comparator<? super T> comparator, @NotNull java.util.concurrent.ThreadPoolExecutor executor, int minDivisionSize) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
T
- list typelist
- list to sort. Doas not need to be threadsafe unless it is also changed o
concurrently outside of this method.comparator
- comparator defining the sort order, has to be threadsafeexecutor
- thread pool executor for parallel sort tasksminDivisionSize
- minimal size of a sublist before standard standard sorting is usedjava.util.concurrent.ExecutionException
- on executor errorsjava.lang.InterruptedException
- if execution was interruptedpublic static <T> void sort(@NotNull java.util.List<T> list, @NotNull java.util.Comparator<? super T> comparator, @NotNull java.util.concurrent.ThreadPoolExecutor executor, int maxThreads, int minDivisionSize) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
T
- list typelist
- list to sort. Doas not need to be threadsafe unless it is also changed o
concurrently outside of this method.comparator
- comparator defining the sort order, has to be threadsafeexecutor
- thread pool executor for parallel sort tasksmaxThreads
- maximum number of parallel sort threads, a positive integerminDivisionSize
- minimal size of a sublist before standard standard sorting is usedjava.util.concurrent.ExecutionException
- on executor errorsjava.lang.InterruptedException
- if execution was interrupted