Top Description Fields Constructors Methods
org.eclipse.collections.impl.forkjoin

public final Class FJIterate

extends Object
Class Inheritance
Imports
java.util.Collection, .List, .RandomAccess, java.util.concurrent.ForkJoinPool, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, org.eclipse.collections.api.block.predicate.Predicate, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.list.ListIterable, org.eclipse.collections.api.map.MutableMap, .MutableMapIterable, org.eclipse.collections.api.multimap.MutableMultimap, org.eclipse.collections.impl.block.procedure.MultimapPutProcedure, .MutatingAggregationProcedure, .NonMutatingAggregationProcedure, org.eclipse.collections.impl.factory.Lists, org.eclipse.collections.impl.list.fixed.ArrayAdapter, org.eclipse.collections.impl.map.mutable.ConcurrentHashMap, org.eclipse.collections.impl.multimap.list.SynchronizedPutFastListMultimap, org.eclipse.collections.impl.parallel.BatchIterable, .CollectIfProcedureCombiner, .CollectIfProcedureFactory, .Combiner, .Combiners, .CountCombiner, .CountProcedureFactory, .FastListCollectProcedureCombiner, .FastListCollectProcedureFactory, .FlatCollectProcedureCombiner, .FlatCollectProcedureFactory, .ObjectIntProcedureFactory, .ParallelArrayIterate, .ParallelIterate, .PassThruCombiner, .PassThruObjectIntProcedureFactory, .PassThruProcedureFactory, .ProcedureFactory, .RejectProcedureCombiner, .RejectProcedureFactory, .SelectProcedureCombiner, .SelectProcedureFactory, org.eclipse.collections.impl.utility.Iterate

The FJIterate class contains several parallel algorithms that work with Collections and make use of Java's fork-join framework. All the higher level parallel algorithms depend on the basic parallel algorithm named 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.

See Also
ParallelIterate

Field Summary

Modifier and TypeField and Description
public static final int
private static final int
private static final ForkJoinPool

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <T, K, V> MutableMap<K, V>
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<K, V>> R
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<K, V>
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<K, V>> R
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<K, V>
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<K, V>> R
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<K, V>
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<K, V>> R
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<K, V>
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<K, V>> R
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<K, V>
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<K, V>> R
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
calculateTaskCount(Iterable<T> iterable, int batchSize)

private static <T> int
calculateTaskCount(BatchIterable<T> batchIterable, int batchSize)

private static int
calculateTaskCount(int size, int batchSize)

public static <T, V> Collection<V>

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).
collect
(Iterable<T> iterable, Function<? super T, V> function)

Same effect as Iterate#collect(Iterable, Function), but executed in parallel batches.

public static <T, V> Collection<V>

Returns:

The collected elements. The Collection will be of the same type (List or Set) as the input.
collect
(Iterable<T> iterable, Function<? super T, V> function, boolean
If the result can be in a different order. Allowing reordering may yield faster execution.
allowReorderedResult
)

Same effect as Iterate#collect(Iterable, Function), but executed in parallel batches, and with potentially reordered result.

public static <T, V, R extends Collection<V>> R

Returns:

The 'target' collection, with the collected elements added.
collect
(Iterable<T> iterable, Function<? super T, V> function, R
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 Iterate#collect(Iterable, Function), but executed in parallel batches, and writing output into the specified collection.

public static <T, V, R extends Collection<V>> R
collect(Iterable<T> iterable, Function<? super T, V> function, R target, int batchSize, ForkJoinPool executor, boolean allowReorderedResult)

public static <T, V> Collection<V>

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).
collectIf
(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, V> function)

Same effect as Iterate#collectIf(Iterable, Predicate, Function), but executed in parallel batches.

public static <T, V> Collection<V>

Returns:

The collected elements. The Collection will be of the same type as the input (List or Set)
collectIf
(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, V> function, boolean
If the result can be in a different order. Allowing reordering may yield faster execution.
allowReorderedResult
)

Same effect as Iterate#collectIf(Iterable, Predicate, Function), but executed in parallel batches, and with potentially reordered results.

public static <T, V, R extends Collection<V>> R

Returns:

The 'target' collection, with the collected elements added.
collectIf
(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, V> function, R
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 Iterate#collectIf(Iterable, Predicate, Function), but executed in parallel batches, and writing output into the specified collection.

public static <T, V, R extends Collection<V>> R
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.
count
(Iterable<T> iterable, Predicate<? super T> predicate)

Same effect as Iterate#count(Iterable, Predicate), but executed in parallel batches.

public static <T> int

Returns:

The number of elements which satisfy the Predicate.
count
(Iterable<T> iterable, Predicate<? super T> predicate, int batchSize, ForkJoinPool executor)

Same effect as Iterate#count(Iterable, Predicate), but executed in parallel batches.

pack-priv static boolean
public static <T, V> Collection<V>
flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function)

public static <T, V> Collection<V>
flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function, boolean allowReorderedResult)

public static <T, V, R extends Collection<V>> R
flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function, R target, boolean allowReorderedResult)

public static <T, V, R extends Collection<V>> R
flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function, R target, int batchSize, ForkJoinPool executor, boolean allowReorderedResult)

public static <T> void
forEach(Iterable<T> iterable, Procedure<? super T> procedure)

Iterate over the collection specified in parallel batches using default runtime parameter values.

public static <T> void
forEach(Iterable<T> iterable, Procedure<? super T> procedure, int batchSize)

Iterate over the collection specified in parallel batches using default runtime parameter values.

public static <T> void
forEach(Iterable<T> iterable, Procedure<? super T> procedure, int batchSize, ForkJoinPool executor)

public static <T, PT extends Procedure<? super T>> void
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<? super T>> void
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<? super T>> void
forEach(Iterable<T> iterable, PT procedure, int minForkSize, int taskCount, ForkJoinPool executor)

public static <T, PT extends Procedure<? super T>> void
forEach(Iterable<T> iterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, ForkJoinPool executor)

public static <T, PT extends Procedure<? super T>> void
forEach(Iterable<T> iterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner)

public static <T, PT extends Procedure<? super T>> void
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<? super T>> void
forEach(Iterable<T> iterable, ProcedureFactory<PT> blockFactory, Combiner<PT> combiner, int batchSize, ForkJoinPool executor)

public static <T, PT extends Procedure<? super T>> void
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<? super T>> void
forEach(Iterable<T> iterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)

public static <T, PT extends Procedure<? super T>> void
forEachInBatchWithExecutor(BatchIterable<T> batchIterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)

public static <T, PT extends Procedure<? super T>> void
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<? super T>> void
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<? super T>> void
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<? super T>> void
forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, ForkJoinPool executor)

public static <T, PT extends ObjectIntProcedure<? super T>> void
forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount)

public static <T, PT extends ObjectIntProcedure<? super T>> void
forEachWithIndex(Iterable<T> iterable, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)

public static <T, PT extends ObjectIntProcedure<? super T>> void
forEachWithIndexInListOnExecutor(List<T> list, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor)

public static <K, V> MutableMultimap<K, V>
groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function)

Same effect as Iterate#groupBy(Iterable, Function), but executed in parallel batches, and writing output into a SynchronizedPutFastListMultimap.

public static <K, V, R extends MutableMultimap<K, V>> MutableMultimap<K, V>
groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, R concurrentMultimap)

Same effect as Iterate#groupBy(Iterable, Function), but executed in parallel batches, and writing output into a SynchronizedPutFastListMultimap.

public static <K, V, R extends MutableMultimap<K, V>> MutableMultimap<K, V>
groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, R concurrentMultimap, int batchSize)

Same effect as Iterate#groupBy(Iterable, Function), but executed in parallel batches, and writing output into a SynchronizedPutFastListMultimap.

public static <K, V> MutableMultimap<K, V>
groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, int batchSize)

Same effect as Iterate#groupBy(Iterable, Function), but executed in parallel batches, and writing output into a SynchronizedPutFastListMultimap.

public static <K, V> MutableMultimap<K, V>
groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, int batchSize, ForkJoinPool executor)

Same effect as Iterate#groupBy(Iterable, Function), but executed in parallel batches, and writing output into a SynchronizedPutFastListMultimap.

public static <K, V, R extends MutableMultimap<K, V>> MutableMultimap<K, V>
groupBy(Iterable<V> iterable, Function<? super V, ? extends K> function, R concurrentMultimap, int batchSize, ForkJoinPool executor)

Same effect as Iterate#groupBy(Iterable, Function), but executed in parallel batches, and writing output into a SynchronizedPutFastListMultimap.

public static <T> Collection<T>

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).
reject
(Iterable<T> iterable, Predicate<? super T> predicate)

Same effect as Iterate#reject(Iterable, Predicate), but executed in parallel batches.

public static <T> Collection<T>

Returns:

The rejected elements. The Collection will be of the same type (List or Set) as the input.
reject
(Iterable<T> iterable, Predicate<? super T> predicate, boolean
If the result can be in a different order. Allowing reordering may yield faster execution.
allowReorderedResult
)

Same effect as Iterate#reject(Iterable, Predicate), but executed in parallel batches, and with a potentially reordered result.

public static <T, R extends Collection<T>> R

Returns:

The 'target' collection, with the rejected elements added.
reject
(Iterable<T> iterable, Predicate<? super T> predicate, R
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 Iterate#reject(Iterable, Predicate), but executed in parallel batches, and writing output into the specified collection.

public static <T, R extends Collection<T>> R
reject(Iterable<T> iterable, Predicate<? super T> predicate, R target, int batchSize, ForkJoinPool executor, boolean allowReorderedResult)

public static <T> Collection<T>

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).
select
(Iterable<T> iterable, Predicate<? super T> predicate)

Same effect as Iterate#select(Iterable, Predicate), but executed in parallel batches.

public static <T> Collection<T>

Returns:

The selected elements. The Collection will be of the same type (List or Set) as the input.
select
(Iterable<T> iterable, Predicate<? super T> predicate, boolean
If the result can be in a different order. Allowing reordering may yield faster execution.
allowReorderedResult
)

Same effect as Iterate#select(Iterable, Predicate), but executed in parallel batches, and with a potentially reordered result.

public static <T, R extends Collection<T>> R

Returns:

The 'target' collection, with the selected elements added.
select
(Iterable<T> iterable, Predicate<? super T> predicate, R
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 Iterate#select(Iterable, Predicate), but executed in parallel batches, and writing output into the specified collection.

public static <T, R extends Collection<T>> R

Returns:

The 'target' collection, with the selected elements added.
select
(Iterable<T> iterable, Predicate<? super T> predicate, R
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 Iterate#select(Iterable, Predicate), but executed in parallel batches, and writing output into the specified collection.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait