forEach. The forEach algorithm employs
a batching fork and join approach.
All Collections that are not either a RandomAccess or List are first converted to a Java array
using Iterate#toArray(Iterable), and then run with one of the ParallelArrayIterate.forEach methods.
ParallelArrayIterate
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final ExecutorService | |
| pack-priv static final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <T, K, V> MutableMap | aggregateBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator)
|
| public static <T, K, V, R extends MutableMapIterable | aggregateBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator, R mutableMap)
|
| public static <T, K, V> MutableMap | aggregateBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator, int batchSize)
|
| public static <T, K, V, R extends MutableMapIterable | aggregateBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator, R mutableMap, int batchSize)
|
| public static <T, K, V> MutableMap | |
| public static <T, K, V, R extends MutableMapIterable | |
| public static <T, K, V> MutableMap | aggregateInPlaceBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator)
|
| public static <T, K, V, R extends MutableMapIterable | aggregateInPlaceBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator, R mutableMap)
|
| public static <T, K, V> MutableMap | aggregateInPlaceBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator, int batchSize)
|
| public static <T, K, V, R extends MutableMapIterable | aggregateInPlaceBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator, R mutableMap, int batchSize)
|
| public static <T, K, V> MutableMap | aggregateInPlaceBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator, int batchSize, Executor executor)
|
| public static <T, K, V, R extends MutableMapIterable | aggregateInPlaceBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator, R mutableMap, int batchSize, Executor executor)
|
| private static <T> int | |
| private static <T> int | |
| private static int | |
| public static <T, V> Collection | Returns: The collected elements. The Collection will be of the same type as the input (List or Set) and will be in the same order as the input (if it is an ordered collection).Same effect as |
| public static <T, V> Collection | Returns: The collected elements. The Collection will be of the same type (List or Set) as the input.If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| public static <T, V, R extends Collection | Returns: The 'target' collection, with the collected elements added.Where to write the output. target, boolean If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| public static <T, V, R extends Collection | |
| public static <T, V> Collection | Returns: The collected elements. The Collection will be of the same type as the input (List or Set) and will be in the same order as the input (if it is an ordered collection).Same effect as |
| public static <T, V> Collection | Returns: The collected elements. The Collection will be of the same type as the input (List or Set)If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| public static <T, V, R extends Collection | Returns: The 'target' collection, with the collected elements added.Where to write the output. target, boolean If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| public static <T, V, R extends Collection | |
| public static <T> int | Returns: The number of elements which satisfy the predicate.Same effect as |
| public static <T> int | Returns: The number of elements which satisfy the predicate.Same effect as |
| public static <T, V> Collection | |
| public static <T, V> Collection | flatCollect(Iterable<T> iterable, Function<? super T, Collection<V>> function, boolean allowReorderedResult)
|
| public static <T, V, R extends Collection | flatCollect(Iterable<T> iterable, Function<? super T, Collection<V>> function, R target, boolean allowReorderedResult)
|
| public static <T, V, R extends Collection | flatCollect(Iterable<T> iterable, Function<? super T, Collection<V>> function, R target, int batchSize, Executor executor, boolean allowReorderedResult)
|
| public static <T> void | |
| public static <T> void | |
| public static <T> void | |
| public static <T, BT extends Procedure | |
| public static <T, BT extends Procedure | forEach(Iterable<T> iterable, BT procedure, int
Only run in parallel if input collection is longer than this. minForkSize, int How many parallel tasks to submit to the executor.
taskCount)Todo How does the taskCount relate to the number of threads in the executor? Iterate over the collection specified in parallel batches using the specified minimum fork and task count sizes. |
| public static <T, BT extends Procedure | |
| public static <T, BT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, Executor executor)
|
| public static <T, BT extends Procedure | |
| public static <T, BT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int batchSize)
Iterate over the collection specified in parallel batches using the default values for the task size. |
| public static <T, BT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int batchSize, Executor executor)
|
| public static <T, BT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount)
Iterate over the collection specified in parallel batches using the default values for the task size. |
| public static <T, BT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor)
|
| public static <T, BT extends Procedure | forEachInBatchWithExecutor(BatchIterable<T> set, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor)
|
| public static <T, BT extends Procedure | forEachInListOnExecutor(List<T> list, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor)
|
| public static <T> void | forEachWithIndex(Iterable<T> iterable, ObjectIntProcedure<? super T> objectIntProcedure)
Iterate over the collection specified, in parallel batches using default runtime parameter values. |
| public static <T, BT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, BT procedure, Executor
Use this executor for all execution. executor)Iterate over the collection specified in parallel batches using the default runtime parameters. |
| public static <T, BT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, BT procedure, int
Only run in parallel if input collection is longer than this. minForkSize, int How many parallel tasks to submit to the executor. taskCount)Iterate over the collection specified in parallel batches. |
| public static <T, BT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, Executor executor)
|
| public static <T, BT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount)
|
| public static <T, BT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor)
|
| public static <T, BT extends ObjectIntProcedure | forEachWithIndexInListOnExecutor(List<T> list, ObjectIntProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor)
|
| public static int | |
| public static int | |
| public static int | |
| public static <K, V> MutableMultimap | groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function)
Same effect as |
| public static <K, V, R extends MutableMultimap | groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, R concurrentMultimap)
Same effect as |
| public static <K, V, R extends MutableMultimap | groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, R concurrentMultimap, int batchSize)
Same effect as |
| public static <K, V> MutableMultimap | groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, int batchSize)
Same effect as |
| public static <K, V> MutableMultimap | groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, int batchSize, Executor executor)
Same effect as |
| public static <K, V, R extends MutableMultimap | groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, R concurrentMultimap, int batchSize, Executor executor)
Same effect as |
| pack-priv static boolean | |
| public static ExecutorService | newPooledExecutor(int newPoolSize, String poolName, boolean useDaemonThreads)
Returns a brand new ExecutorService using the specified poolName with the specified maximum thread pool size. |
| public static ExecutorService | newPooledExecutor(String poolName, boolean useDaemonThreads)
Returns a brand new ExecutorService using the specified poolName and uses the optional property named to set the maximum thread pool size. |
| public static <T> Collection | Returns: The rejected elements. The Collection will be of the same type as the input (List or Set) and will be in the same order as the input (if it is an ordered collection).Same effect as |
| public static <T> Collection | Returns: The rejected elements. The Collection will be of the same type (List or Set) as the input.If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| public static <T, R extends Collection | Returns: The 'target' collection, with the rejected elements added.Where to write the output. target, boolean If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| public static <T, R extends Collection | |
| public static <T> Collection | Returns: The selected elements. The Collection will be of the same type as the input (List or Set) and will be in the same order as the input (if it is an ordered collection).Same effect as |
| public static <T> Collection | Returns: The selected elements. The Collection will be of the same type (List or Set) as the input.If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| public static <T, R extends Collection | Returns: The 'target' collection, with the selected elements added.Where to write the output. target, boolean If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| public static <T, R extends Collection | Returns: The 'target' collection, with the selected elements added.Where to write the output. target, int batchSize, Executor executor, boolean If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |
| pack-priv static void | |
| public static <V, T> MutableMap | sumByBigDecimal(Iterable<T> iterable, Function<? super T, ? extends V> groupBy, Function<? super T, BigDecimal> function)
|
| public static <V, T> MutableMap | sumByBigInteger(Iterable<T> iterable, Function<? super T, ? extends V> groupBy, Function<? super T, BigInteger> function)
|
| public static <T, V> ObjectDoubleMap | sumByDouble(Iterable<T> iterable, Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)
|
| public static <T, V> ObjectDoubleMap | sumByFloat(Iterable<T> iterable, Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)
|
| public static <T, V> ObjectLongMap | sumByInt(Iterable<T> iterable, Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)
|
| public static <T, V> ObjectLongMap | sumByLong(Iterable<T> iterable, Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)
|