public static <T> Combiner<T> passThru() { return new PassThruCombiner<>(); } }
public static <T> Combiner<T> passThru() { return new PassThruCombiner<>(); } }
/** * 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); }
/** * Iterate over the collection specified in parallel batches. The * ObjectIntProcedure used must be stateless, or use concurrent aware objects if they are to be shared. The * specified minimum fork size and task count are used instead of the default values. * * @param minForkSize Only run in parallel if input collection is longer than this. * @param taskCount How many parallel tasks to submit to the executor. * @see #forEachWithIndex(Iterable, ObjectIntProcedure) */ public static <T, BT extends ObjectIntProcedure<? super T>> void forEachWithIndex( Iterable<T> iterable, BT procedure, int minForkSize, int taskCount) { ParallelIterate.forEachWithIndex( iterable, new PassThruObjectIntProcedureFactory<>(procedure), new PassThruCombiner<>(), minForkSize, taskCount); }
/** * Iterate over the collection specified in parallel batches. The * ObjectIntProcedure used must be stateless, or use concurrent aware objects if they are to be shared. The * specified minimum fork size and task count are used instead of the default values. * * @param minForkSize Only run in parallel if input collection is longer than this. * @param taskCount How many parallel tasks to submit to the executor. * @see #forEachWithIndex(Iterable, ObjectIntProcedure) */ public static <T, BT extends ObjectIntProcedure<? super T>> void forEachWithIndex( Iterable<T> iterable, BT procedure, int minForkSize, int taskCount) { ParallelIterate.forEachWithIndex( iterable, new PassThruObjectIntProcedureFactory<>(procedure), new PassThruCombiner<>(), minForkSize, taskCount); }
/** * Iterate over the collection specified in parallel batches using the default runtime parameters. The * ObjectIntProcedure used must be stateless, or use concurrent aware objects if they are to be shared. The code * is executed against the specified executor. * <p> * <pre>e.g. * final Map<Integer, Object> chm = new ConcurrentHashMap<Integer, Object>(); * ParallelIterate.<b>forEachWithIndex</b>(collection, new ObjectIntProcedure() * { * public void value(Object object, int index) * { * chm.put(index, object); * } * }, executor); * </pre> * * @param executor Use this executor for all execution. */ public static <T, BT extends ObjectIntProcedure<? super T>> void forEachWithIndex( Iterable<T> iterable, BT procedure, Executor executor) { ParallelIterate.forEachWithIndex( iterable, new PassThruObjectIntProcedureFactory<>(procedure), new PassThruCombiner<>(), executor); }
/** * Iterate over the collection specified in parallel batches using the default runtime parameters. The * ObjectIntProcedure used must be stateless, or use concurrent aware objects if they are to be shared. The code * is executed against the specified executor. * <p> * <pre>e.g. * final Map<Integer, Object> chm = new ConcurrentHashMap<Integer, Object>(); * ParallelIterate.<b>forEachWithIndex</b>(collection, new ObjectIntProcedure() * { * public void value(Object object, int index) * { * chm.put(index, object); * } * }, executor); * </pre> * * @param executor Use this executor for all execution. */ public static <T, BT extends ObjectIntProcedure<? super T>> void forEachWithIndex( Iterable<T> iterable, BT procedure, Executor executor) { ParallelIterate.forEachWithIndex( iterable, new PassThruObjectIntProcedureFactory<>(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); } }
/** * 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); } }
/** * 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); } }
public static <T> Combiner<T> passThru() { return new PassThruCombiner<>(); } }
/** * 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); }
public static <T, PT extends ObjectIntProcedure<? super T>> void forEachWithIndex( Iterable<T> iterable, ObjectIntProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, ForkJoinPool executor) { int taskCount = Math.max( FJIterate.DEFAULT_PARALLEL_TASK_COUNT, Iterate.sizeOf(iterable) / DEFAULT_MIN_FORK_SIZE); FJIterate.forEachWithIndex(iterable, procedureFactory, combiner, DEFAULT_MIN_FORK_SIZE, taskCount, 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); } }