Class AbstractParallelIterable<T,B extends Batch<T>>
- java.lang.Object
-
- org.eclipse.collections.impl.lazy.parallel.AbstractParallelIterable<T,B>
-
- All Implemented Interfaces:
ParallelIterable<T>
- Direct Known Subclasses:
AbstractParallelIterableImpl
,AbstractParallelListIterable
,AbstractParallelSortedSetIterable
,AbstractParallelUnsortedBag
,AbstractParallelUnsortedSetIterable
public abstract class AbstractParallelIterable<T,B extends Batch<T>> extends java.lang.Object implements ParallelIterable<T>
-
-
Constructor Summary
Constructors Constructor Description AbstractParallelIterable()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <K,V>
MapIterable<K,V>aggregateBy(Function<? super T,? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V,? super T,? extends V> nonMutatingAggregator)
<K,V>
MapIterable<K,V>aggregateInPlaceBy(Function<? super T,? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V,? super T> mutatingAggregator)
protected static <T> boolean
allSatisfy(AbstractParallelIterable<T,? extends RootBatch<T>> parallelIterable, Predicate<? super T> predicate)
<P> boolean
allSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
protected static <T> boolean
anySatisfy(AbstractParallelIterable<T,? extends RootBatch<T>> parallelIterable, Predicate<? super T> predicate)
<P> boolean
anySatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
void
appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
protected <S,V>
voidcollectCombine(Function<Batch<T>,V> function, Procedure2<S,V> combineProcedure, S state)
private <S,V>
voidcollectCombineOrdered(Function<Batch<T>,V> function, Procedure2<S,V> combineProcedure, S state)
private <S,V>
voidcollectCombineUnordered(Function<Batch<T>,V> function, Procedure2<S,V> combineProcedure, S state)
private T
collectReduce(Function<Batch<T>,T> map, Function2<T,T,T> function2)
private T
collectReduceOrdered(Function<Batch<T>,T> map, Function2<T,T,T> function2)
private T
collectReduceUnordered(Function<Batch<T>,T> map, Function2<T,T,T> function2)
int
count(Predicate<? super T> predicate)
<P> int
countWith(Predicate2<? super T,? super P> predicate, P parameter)
protected static <T> T
detect(AbstractParallelIterable<T,? extends RootBatch<T>> parallelIterable, Predicate<? super T> predicate)
T
detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)
<P> T
detectWith(Predicate2<? super T,? super P> predicate, P parameter)
<P> T
detectWithIfNone(Predicate2<? super T,? super P> predicate, P parameter, Function0<? extends T> function)
protected static <T> void
forEach(AbstractParallelIterable<T,? extends RootBatch<T>> parallelIterable, Procedure<? super T> procedure)
<P> void
forEachWith(Procedure2<? super T,? super P> procedure, P parameter)
abstract int
getBatchSize()
abstract java.util.concurrent.ExecutorService
getExecutorService()
<V> MapIterable<V,T>
groupByUniqueKey(Function<? super T,? extends V> function)
protected abstract boolean
isOrdered()
T
max()
T
max(java.util.Comparator<? super T> comparator)
<V extends java.lang.Comparable<? super V>>
TmaxBy(Function<? super T,? extends V> function)
T
min()
T
min(java.util.Comparator<? super T> comparator)
<V extends java.lang.Comparable<? super V>>
TminBy(Function<? super T,? extends V> function)
boolean
noneSatisfy(Predicate<? super T> predicate)
<P> boolean
noneSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
abstract LazyIterable<B>
split()
double
sumOfDouble(DoubleFunction<? super T> function)
Returns the final double result of evaluating function for each element of the iterable in parallel and adding the results together.private double
sumOfDoubleOrdered(Function<Batch<T>,DoubleSumResultHolder> map)
double
sumOfFloat(FloatFunction<? super T> function)
Returns the final double result of evaluating function for each element of the iterable in parallel and adding the results together.long
sumOfInt(IntFunction<? super T> function)
Returns the final long result of evaluating function for each element of the iterable in parallel and adding the results together.long
sumOfLong(LongFunction<? super T> function)
Returns the final long result of evaluating function for each element of the iterable in parallel and adding the results together.private long
sumOfLongOrdered(LongFunction<Batch<T>> map)
<E> E[]
toArray(E[] array)
MutableBag<T>
toBag()
MutableList<T>
toList()
<NK,NV>
MutableMap<NK,NV>toMap(Function<? super T,? extends NK> keyFunction, Function<? super T,? extends NV> valueFunction)
MutableSet<T>
toSet()
MutableSortedBag<T>
toSortedBag()
MutableSortedBag<T>
toSortedBag(java.util.Comparator<? super T> comparator)
<V extends java.lang.Comparable<? super V>>
MutableSortedBag<T>toSortedBagBy(Function<? super T,? extends V> function)
MutableList<T>
toSortedList(java.util.Comparator<? super T> comparator)
<V extends java.lang.Comparable<? super V>>
MutableList<T>toSortedListBy(Function<? super T,? extends V> function)
<NK,NV>
MutableSortedMap<NK,NV>toSortedMap(java.util.Comparator<? super NK> comparator, Function<? super T,? extends NK> keyFunction, Function<? super T,? extends NV> valueFunction)
<NK,NV>
MutableSortedMap<NK,NV>toSortedMap(Function<? super T,? extends NK> keyFunction, Function<? super T,? extends NV> valueFunction)
MutableSortedSet<T>
toSortedSet()
MutableSortedSet<T>
toSortedSet(java.util.Comparator<? super T> comparator)
<V extends java.lang.Comparable<? super V>>
MutableSortedSet<T>toSortedSetBy(Function<? super T,? extends V> function)
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.ParallelIterable
allSatisfy, anySatisfy, appendString, appendString, asUnique, collect, collectIf, collectWith, detect, flatCollect, forEach, groupBy, groupByEach, makeString, makeString, makeString, makeString, reject, rejectWith, select, selectInstancesOf, selectWith, toArray, toSortedList
-
-
-
-
Method Detail
-
forEach
protected static <T> void forEach(AbstractParallelIterable<T,? extends RootBatch<T>> parallelIterable, Procedure<? super T> procedure)
-
anySatisfy
protected static <T> boolean anySatisfy(AbstractParallelIterable<T,? extends RootBatch<T>> parallelIterable, Predicate<? super T> predicate)
-
allSatisfy
protected static <T> boolean allSatisfy(AbstractParallelIterable<T,? extends RootBatch<T>> parallelIterable, Predicate<? super T> predicate)
-
detect
protected static <T> T detect(AbstractParallelIterable<T,? extends RootBatch<T>> parallelIterable, Predicate<? super T> predicate)
-
getExecutorService
public abstract java.util.concurrent.ExecutorService getExecutorService()
-
getBatchSize
public abstract int getBatchSize()
-
split
public abstract LazyIterable<B> split()
-
isOrdered
protected abstract boolean isOrdered()
-
collectCombine
protected <S,V> void collectCombine(Function<Batch<T>,V> function, Procedure2<S,V> combineProcedure, S state)
-
collectCombineOrdered
private <S,V> void collectCombineOrdered(Function<Batch<T>,V> function, Procedure2<S,V> combineProcedure, S state)
-
collectCombineUnordered
private <S,V> void collectCombineUnordered(Function<Batch<T>,V> function, Procedure2<S,V> combineProcedure, S state)
-
collectReduceOrdered
private T collectReduceOrdered(Function<Batch<T>,T> map, Function2<T,T,T> function2)
-
collectReduceUnordered
private T collectReduceUnordered(Function<Batch<T>,T> map, Function2<T,T,T> function2)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
appendString
public void appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
- Specified by:
appendString
in interfaceParallelIterable<T>
-
forEachWith
public <P> void forEachWith(Procedure2<? super T,? super P> procedure, P parameter)
- Specified by:
forEachWith
in interfaceParallelIterable<T>
-
anySatisfyWith
public <P> boolean anySatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
anySatisfyWith
in interfaceParallelIterable<T>
-
allSatisfyWith
public <P> boolean allSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
allSatisfyWith
in interfaceParallelIterable<T>
-
noneSatisfy
public boolean noneSatisfy(Predicate<? super T> predicate)
- Specified by:
noneSatisfy
in interfaceParallelIterable<T>
-
noneSatisfyWith
public <P> boolean noneSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
noneSatisfyWith
in interfaceParallelIterable<T>
-
detectWith
public <P> T detectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
detectWith
in interfaceParallelIterable<T>
-
detectIfNone
public T detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)
- Specified by:
detectIfNone
in interfaceParallelIterable<T>
-
detectWithIfNone
public <P> T detectWithIfNone(Predicate2<? super T,? super P> predicate, P parameter, Function0<? extends T> function)
- Specified by:
detectWithIfNone
in interfaceParallelIterable<T>
-
toArray
public <E> E[] toArray(E[] array)
- Specified by:
toArray
in interfaceParallelIterable<T>
-
toList
public MutableList<T> toList()
- Specified by:
toList
in interfaceParallelIterable<T>
-
toSortedList
public MutableList<T> toSortedList(java.util.Comparator<? super T> comparator)
- Specified by:
toSortedList
in interfaceParallelIterable<T>
-
toSortedListBy
public <V extends java.lang.Comparable<? super V>> MutableList<T> toSortedListBy(Function<? super T,? extends V> function)
- Specified by:
toSortedListBy
in interfaceParallelIterable<T>
-
toSet
public MutableSet<T> toSet()
- Specified by:
toSet
in interfaceParallelIterable<T>
-
toSortedSet
public MutableSortedSet<T> toSortedSet()
- Specified by:
toSortedSet
in interfaceParallelIterable<T>
-
toSortedSetBy
public <V extends java.lang.Comparable<? super V>> MutableSortedSet<T> toSortedSetBy(Function<? super T,? extends V> function)
- Specified by:
toSortedSetBy
in interfaceParallelIterable<T>
-
toBag
public MutableBag<T> toBag()
- Specified by:
toBag
in interfaceParallelIterable<T>
-
toSortedBag
public MutableSortedBag<T> toSortedBag()
- Specified by:
toSortedBag
in interfaceParallelIterable<T>
-
toSortedBag
public MutableSortedBag<T> toSortedBag(java.util.Comparator<? super T> comparator)
- Specified by:
toSortedBag
in interfaceParallelIterable<T>
-
toSortedBagBy
public <V extends java.lang.Comparable<? super V>> MutableSortedBag<T> toSortedBagBy(Function<? super T,? extends V> function)
- Specified by:
toSortedBagBy
in interfaceParallelIterable<T>
-
toSortedSet
public MutableSortedSet<T> toSortedSet(java.util.Comparator<? super T> comparator)
- Specified by:
toSortedSet
in interfaceParallelIterable<T>
-
toMap
public <NK,NV> MutableMap<NK,NV> toMap(Function<? super T,? extends NK> keyFunction, Function<? super T,? extends NV> valueFunction)
- Specified by:
toMap
in interfaceParallelIterable<T>
-
toSortedMap
public <NK,NV> MutableSortedMap<NK,NV> toSortedMap(Function<? super T,? extends NK> keyFunction, Function<? super T,? extends NV> valueFunction)
- Specified by:
toSortedMap
in interfaceParallelIterable<T>
-
toSortedMap
public <NK,NV> MutableSortedMap<NK,NV> toSortedMap(java.util.Comparator<? super NK> comparator, Function<? super T,? extends NK> keyFunction, Function<? super T,? extends NV> valueFunction)
- Specified by:
toSortedMap
in interfaceParallelIterable<T>
-
aggregateBy
public <K,V> MapIterable<K,V> aggregateBy(Function<? super T,? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V,? super T,? extends V> nonMutatingAggregator)
- Specified by:
aggregateBy
in interfaceParallelIterable<T>
-
aggregateInPlaceBy
public <K,V> MapIterable<K,V> aggregateInPlaceBy(Function<? super T,? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V,? super T> mutatingAggregator)
- Specified by:
aggregateInPlaceBy
in interfaceParallelIterable<T>
-
count
public int count(Predicate<? super T> predicate)
- Specified by:
count
in interfaceParallelIterable<T>
-
countWith
public <P> int countWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
countWith
in interfaceParallelIterable<T>
-
min
public T min(java.util.Comparator<? super T> comparator)
- Specified by:
min
in interfaceParallelIterable<T>
-
max
public T max(java.util.Comparator<? super T> comparator)
- Specified by:
max
in interfaceParallelIterable<T>
-
min
public T min()
- Specified by:
min
in interfaceParallelIterable<T>
-
max
public T max()
- Specified by:
max
in interfaceParallelIterable<T>
-
minBy
public <V extends java.lang.Comparable<? super V>> T minBy(Function<? super T,? extends V> function)
- Specified by:
minBy
in interfaceParallelIterable<T>
-
maxBy
public <V extends java.lang.Comparable<? super V>> T maxBy(Function<? super T,? extends V> function)
- Specified by:
maxBy
in interfaceParallelIterable<T>
-
sumOfInt
public long sumOfInt(IntFunction<? super T> function)
Description copied from interface:ParallelIterable
Returns the final long result of evaluating function for each element of the iterable in parallel and adding the results together.- Specified by:
sumOfInt
in interfaceParallelIterable<T>
-
sumOfFloat
public double sumOfFloat(FloatFunction<? super T> function)
Description copied from interface:ParallelIterable
Returns the final double result of evaluating function for each element of the iterable in parallel and adding the results together. It uses Kahan summation algorithm to reduce numerical error.- Specified by:
sumOfFloat
in interfaceParallelIterable<T>
-
sumOfLong
public long sumOfLong(LongFunction<? super T> function)
Description copied from interface:ParallelIterable
Returns the final long result of evaluating function for each element of the iterable in parallel and adding the results together.- Specified by:
sumOfLong
in interfaceParallelIterable<T>
-
sumOfDouble
public double sumOfDouble(DoubleFunction<? super T> function)
Description copied from interface:ParallelIterable
Returns the final double result of evaluating function for each element of the iterable in parallel and adding the results together. It uses Kahan summation algorithm to reduce numerical error.- Specified by:
sumOfDouble
in interfaceParallelIterable<T>
-
sumOfLongOrdered
private long sumOfLongOrdered(LongFunction<Batch<T>> map)
-
sumOfDoubleOrdered
private double sumOfDoubleOrdered(Function<Batch<T>,DoubleSumResultHolder> map)
-
groupByUniqueKey
public <V> MapIterable<V,T> groupByUniqueKey(Function<? super T,? extends V> function)
- Specified by:
groupByUniqueKey
in interfaceParallelIterable<T>
-
-