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 FJIterate.forEach methods.
ParallelIterate
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| private static final int | |
| private static final ForkJoinPool |
| 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 | aggregateBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator, int batchSize, ForkJoinPool executor)
|
| 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, ForkJoinPool executor)
|
| 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, ForkJoinPool 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, ForkJoinPool 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 | collect(Iterable<T> iterable, Function<? super T, V> function, R target, int batchSize, ForkJoinPool executor, boolean allowReorderedResult)
|
| 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 | collectIf(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, V> function, R target, int batchSize, ForkJoinPool executor, boolean allowReorderedResult)
|
| 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 |
| pack-priv static boolean | |
| public static <T, V> Collection | |
| public static <T, V> Collection | flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function, boolean allowReorderedResult)
|
| public static <T, V, R extends Collection | flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function, R target, boolean allowReorderedResult)
|
| public static <T, V, R extends Collection | flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function, R target, int batchSize, ForkJoinPool executor, boolean allowReorderedResult)
|
| public static <T> void | |
| public static <T> void | |
| public static <T> void | |
| public static <T, PT extends Procedure | forEach(Iterable<T> iterable, PT procedure, ForkJoinPool
Use this executor for all execution. executor)Iterate over the collection specified in parallel batches using default runtime parameter values and the specified executor. |
| public static <T, PT extends Procedure | forEach(Iterable<T> iterable, PT procedure, int
Only run in parallel if input collection is longer than this. minForkSize, int The number of parallel tasks to submit to the executor. taskCount)Iterate over the collection specified in parallel batches using the specified minimum fork and task count sizes. |
| public static <T, PT extends Procedure | |
| public static <T, PT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, ForkJoinPool executor)
|
| public static <T, PT extends Procedure | |
| public static <T, PT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int batchSize)
Iterate over the collection specified in parallel batches using the default values for the task size. |
| public static <T, PT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<PT> blockFactory, Combiner<PT> combiner, int batchSize, ForkJoinPool executor)
|
| public static <T, PT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount)
Iterate over the collection specified in parallel batches using the default values for the task size. |
| public static <T, PT extends Procedure | forEach(Iterable<T> iterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)
|
| public static <T, PT extends Procedure | forEachInBatchWithExecutor(BatchIterable<T> batchIterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)
|
| public static <T, PT extends Procedure | forEachInListOnExecutor(List<T> list, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)
|
| public static <T> void | forEachWithIndex(Iterable<T> iterable, ObjectIntProcedure<? super T> procedure)
Iterate over the collection specified, in parallel batches using default runtime parameter values. |
| public static <T, PT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, PT procedure, ForkJoinPool
Use this executor for all execution. executor)Iterate over the collection specified in parallel batches using the default runtime parameters. |
| public static <T, PT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, PT procedure, int
Only run in parallel if input collection is longer than this. minForkSize, int The number of parallel tasks to submit to the executor. taskCount)Iterate over the collection specified in parallel batches. |
| public static <T, PT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, ForkJoinPool executor)
|
| public static <T, PT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount)
|
| public static <T, PT extends ObjectIntProcedure | forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)
|
| public static <T, PT extends ObjectIntProcedure | forEachWithIndexInListOnExecutor(List<T> list, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)
|
| 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, ForkJoinPool 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, ForkJoinPool executor)
Same effect as |
| 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 | reject(Iterable<T> iterable, Predicate<? super T> predicate, R target, int batchSize, ForkJoinPool executor, boolean allowReorderedResult)
|
| 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, ForkJoinPool executor, boolean If the result can be in a different order.
Allowing reordering may yield faster execution. allowReorderedResult)Same effect as |