/** * Iterate over the collection specified in parallel batches using default runtime parameter values * and the specified executor. * The {@code Procedure} used must be stateless, or use concurrent aware objects if they are to be shared. * * @param executor Use this executor for all execution. * @see #forEach(Iterable, Procedure) */ public static <T, BT extends Procedure<? super T>> void forEach( Iterable<T> iterable, BT procedure, Executor executor) { ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(procedure), new PassThruCombiner<>(), executor); }
/** * Iterate over the collection specified in parallel batches using default runtime parameter values * and the specified executor. * The {@code Procedure} used must be stateless, or use concurrent aware objects if they are to be shared. * * @param executor Use this executor for all execution. * @see #forEach(Iterable, Procedure) */ public static <T, BT extends Procedure<? super T>> void forEach( Iterable<T> iterable, BT procedure, Executor executor) { ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(procedure), new PassThruCombiner<>(), executor); }
public static <T, BT extends Procedure<? super T>> void forEach( Iterable<T> iterable, BT procedure, int minForkSize, int taskCount, Executor executor) { ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(procedure), new PassThruCombiner<>(), minForkSize, taskCount, executor); }
public static <T, BT extends Procedure<? super T>> void forEach( Iterable<T> iterable, BT procedure, int minForkSize, int taskCount, Executor executor) { ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(procedure), new PassThruCombiner<>(), minForkSize, taskCount, executor); }
/** * A parallel form of forEachKeyValue. * * @see MapIterate#forEachKeyValue(Map, Procedure2) * @see ParallelIterate */ public static <K, V> void forEachKeyValue( Map<K, V> map, Procedure2<? super K, ? super V> procedure, int minForkSize, int taskCount) { if (map.size() > minForkSize) { Procedure<Pair<K, V>> pairProcedure = new PairProcedure<>(procedure); ParallelIterate.forEach(MapIterate.toListOfPairs(map), new PassThruProcedureFactory<>(pairProcedure), new PassThruCombiner<>(), minForkSize, taskCount); } else { MapIterate.forEachKeyValue(map, procedure); } }
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, Executor executor) { MutableMap<K, V> map = ConcurrentHashMap.newMap(); MutatingAggregationProcedure<T, K, V> mutatingAggregationProcedure = new MutatingAggregationProcedure<>(map, groupBy, zeroValueFactory, mutatingAggregator); ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(mutatingAggregationProcedure), Combiners.<Procedure<T>>passThru(), batchSize, executor); return map; }
/** * A parallel form of forEachKeyValue. * * @see MapIterate#forEachKeyValue(Map, Procedure2) * @see ParallelIterate */ public static <K, V> void forEachKeyValue( Map<K, V> map, Procedure2<? super K, ? super V> procedure, int minForkSize, int taskCount) { if (map.size() > minForkSize) { Procedure<Pair<K, V>> pairProcedure = new PairProcedure<>(procedure); ParallelIterate.forEach(MapIterate.toListOfPairs(map), new PassThruProcedureFactory<>(pairProcedure), new PassThruCombiner<>(), minForkSize, taskCount); } else { MapIterate.forEachKeyValue(map, procedure); } }
/** * Same effect as {@link 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, Executor executor) { ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(new MultimapPutProcedure<>(concurrentMultimap, function)), Combiners.<Procedure<V>>passThru(), batchSize, executor); return concurrentMultimap; }
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, Executor executor) { MutableMap<K, V> map = ConcurrentHashMap.newMap(); MutatingAggregationProcedure<T, K, V> mutatingAggregationProcedure = new MutatingAggregationProcedure<>(map, groupBy, zeroValueFactory, mutatingAggregator); ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(mutatingAggregationProcedure), Combiners.<Procedure<T>>passThru(), batchSize, executor); return map; }
/** * Same effect as {@link 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, Executor executor) { ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(new MultimapPutProcedure<>(concurrentMultimap, function)), Combiners.<Procedure<V>>passThru(), batchSize, executor); return concurrentMultimap; }
/** * A parallel form of forEachKeyValue. * * @see MapIterate#forEachKeyValue(Map, Procedure2) * @see ParallelIterate */ public static <K, V> void forEachKeyValue( Map<K, V> map, Procedure2<? super K, ? super V> procedure, int minForkSize, int taskCount, Executor executor) { if (map.size() > minForkSize) { Procedure<Pair<K, V>> pairProcedure = new PairProcedure<>(procedure); ParallelIterate.forEachInListOnExecutor( MapIterate.toListOfPairs(map), new PassThruProcedureFactory<>(pairProcedure), new PassThruCombiner<>(), minForkSize, taskCount, executor); } else { MapIterate.forEachKeyValue(map, procedure); } }
/** * A parallel form of forEachKeyValue. * * @see MapIterate#forEachKeyValue(Map, Procedure2) * @see ParallelIterate */ public static <K, V> void forEachKeyValue( Map<K, V> map, Procedure2<? super K, ? super V> procedure, int minForkSize, int taskCount, Executor executor) { if (map.size() > minForkSize) { Procedure<Pair<K, V>> pairProcedure = new PairProcedure<>(procedure); ParallelIterate.forEachInListOnExecutor( MapIterate.toListOfPairs(map), new PassThruProcedureFactory<>(pairProcedure), new PassThruCombiner<>(), minForkSize, taskCount, executor); } else { MapIterate.forEachKeyValue(map, procedure); } }
ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(nonMutatingAggregationProcedure), Combiners.<Procedure<T>>passThru(), batchSize, ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(mutatingAggregationProcedure), Combiners.<Procedure<T>>passThru(), batchSize,
ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(nonMutatingAggregationProcedure), Combiners.<Procedure<T>>passThru(), batchSize, ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(mutatingAggregationProcedure), Combiners.<Procedure<T>>passThru(), batchSize,
/** * Iterate over the collection specified in parallel batches using default runtime parameter values * and the specified executor. * The {@code Procedure} used must be stateless, or use concurrent aware objects if they are to be shared. * * @param executor Use this executor for all execution. * @see #forEach(Iterable, Procedure) */ public static <T, PT extends Procedure<? super T>> void forEach( Iterable<T> iterable, PT procedure, ForkJoinPool executor) { PassThruProcedureFactory<PT> procedureFactory = new PassThruProcedureFactory<>(procedure); PassThruCombiner<PT> combiner = new PassThruCombiner<>(); FJIterate.forEach(iterable, procedureFactory, combiner, executor); }
/** * Iterate over the collection specified in parallel batches using default runtime parameter values * and the specified executor. * The {@code Procedure} used must be stateless, or use concurrent aware objects if they are to be shared. * * @param executor Use this executor for all execution. * @see #forEach(Iterable, Procedure) */ public static <T, BT extends Procedure<? super T>> void forEach( Iterable<T> iterable, BT procedure, Executor executor) { ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(procedure), new PassThruCombiner<>(), executor); }
public static <T, PT extends Procedure<? super T>> void forEach( Iterable<T> iterable, PT procedure, int minForkSize, int taskCount, ForkJoinPool executor) { PassThruProcedureFactory<PT> procedureFactory = new PassThruProcedureFactory<>(procedure); PassThruCombiner<PT> combiner = new PassThruCombiner<>(); FJIterate.forEach(iterable, procedureFactory, combiner, minForkSize, taskCount, executor); }
public static <T, BT extends Procedure<? super T>> void forEach( Iterable<T> iterable, BT procedure, int minForkSize, int taskCount, Executor executor) { ParallelIterate.forEach( iterable, new PassThruProcedureFactory<>(procedure), new PassThruCombiner<>(), minForkSize, taskCount, executor); }
/** * A parallel form of forEachKeyValue. * * @see MapIterate#forEachKeyValue(Map, Procedure2) * @see ParallelIterate */ public static <K, V> void forEachKeyValue( Map<K, V> map, Procedure2<? super K, ? super V> procedure, int minForkSize, int taskCount) { if (map.size() > minForkSize) { Procedure<Pair<K, V>> pairProcedure = new PairProcedure<>(procedure); ParallelIterate.forEach(MapIterate.toListOfPairs(map), new PassThruProcedureFactory<>(pairProcedure), new PassThruCombiner<>(), minForkSize, taskCount); } else { MapIterate.forEachKeyValue(map, procedure); } }
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) { MutableMap<K, V> map = ConcurrentHashMap.newMap(); MutatingAggregationProcedure<T, K, V> mutatingAggregationProcedure = new MutatingAggregationProcedure<>(map, groupBy, zeroValueFactory, mutatingAggregator); FJIterate.forEach( iterable, new PassThruProcedureFactory<>(mutatingAggregationProcedure), Combiners.<Procedure<T>>passThru(), batchSize, executor); return map; }