Search in sources :

Example 1 with Predicate

use of org.eclipse.collections.api.block.predicate.Predicate in project eclipse-collections by eclipse.

the class AbstractParallelIterable method count.

@Override
public int count(Predicate<? super T> predicate) {
    Function<Batch<T>, Integer> map = batch -> batch.count(predicate);
    Counter state = new Counter();
    this.collectCombineUnordered(map, Counter::add, state);
    return state.getCount();
}
Also used : Predicate(org.eclipse.collections.api.block.predicate.Predicate) Predicate2(org.eclipse.collections.api.block.predicate.Predicate2) CompositeFastList(org.eclipse.collections.impl.list.mutable.CompositeFastList) MutableBag(org.eclipse.collections.api.bag.MutableBag) MutableList(org.eclipse.collections.api.list.MutableList) Functions2(org.eclipse.collections.impl.block.factory.Functions2) CompletionService(java.util.concurrent.CompletionService) MutableSortedMap(org.eclipse.collections.api.map.sorted.MutableSortedMap) MutableSet(org.eclipse.collections.api.set.MutableSet) Future(java.util.concurrent.Future) MutatingAggregationProcedure(org.eclipse.collections.impl.block.procedure.MutatingAggregationProcedure) HashBag(org.eclipse.collections.impl.bag.mutable.HashBag) DoubleFunction(org.eclipse.collections.api.block.function.primitive.DoubleFunction) NonMutatingAggregationProcedure(org.eclipse.collections.impl.block.procedure.NonMutatingAggregationProcedure) Comparators(org.eclipse.collections.impl.block.factory.Comparators) LongFunction(org.eclipse.collections.api.block.function.primitive.LongFunction) UnifiedMap(org.eclipse.collections.impl.map.mutable.UnifiedMap) CollectionAddProcedure(org.eclipse.collections.impl.block.procedure.CollectionAddProcedure) CheckedProcedure2(org.eclipse.collections.impl.block.procedure.checked.CheckedProcedure2) Set(java.util.Set) MutableSortedBag(org.eclipse.collections.api.bag.sorted.MutableSortedBag) Procedures(org.eclipse.collections.impl.block.factory.Procedures) MutableSortedSet(org.eclipse.collections.api.set.sorted.MutableSortedSet) TreeSortedSet(org.eclipse.collections.impl.set.sorted.mutable.TreeSortedSet) Procedure2(org.eclipse.collections.api.block.procedure.Procedure2) ExecutorCompletionService(java.util.concurrent.ExecutorCompletionService) FloatFunction(org.eclipse.collections.api.block.function.primitive.FloatFunction) ConcurrentHashMap(org.eclipse.collections.impl.map.mutable.ConcurrentHashMap) Beta(org.eclipse.collections.api.annotation.Beta) Function(org.eclipse.collections.api.block.function.Function) Callable(java.util.concurrent.Callable) Procedure(org.eclipse.collections.api.block.procedure.Procedure) SetAdapter(org.eclipse.collections.impl.set.mutable.SetAdapter) FastList(org.eclipse.collections.impl.list.mutable.FastList) ParallelIterable(org.eclipse.collections.api.ParallelIterable) LazyIterable(org.eclipse.collections.api.LazyIterable) Function0(org.eclipse.collections.api.block.function.Function0) MutableMap(org.eclipse.collections.api.map.MutableMap) Function2(org.eclipse.collections.api.block.function.Function2) TreeBag(org.eclipse.collections.impl.bag.sorted.mutable.TreeBag) NoSuchElementException(java.util.NoSuchElementException) ExecutorService(java.util.concurrent.ExecutorService) Predicates(org.eclipse.collections.impl.block.factory.Predicates) Counter(org.eclipse.collections.impl.Counter) TreeSortedMap(org.eclipse.collections.impl.map.sorted.mutable.TreeSortedMap) IOException(java.io.IOException) IntFunction(org.eclipse.collections.api.block.function.primitive.IntFunction) ExecutionException(java.util.concurrent.ExecutionException) DoubleSumResultHolder(org.eclipse.collections.impl.block.procedure.DoubleSumResultHolder) MapCollectProcedure(org.eclipse.collections.impl.block.procedure.MapCollectProcedure) ConcurrentHashMapUnsafe(org.eclipse.collections.impl.map.mutable.ConcurrentHashMapUnsafe) MapIterable(org.eclipse.collections.api.map.MapIterable) Comparator(java.util.Comparator) Collections(java.util.Collections) UnifiedSet(org.eclipse.collections.impl.set.mutable.UnifiedSet) Counter(org.eclipse.collections.impl.Counter)

Aggregations

IOException (java.io.IOException)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 NoSuchElementException (java.util.NoSuchElementException)1 Set (java.util.Set)1 Callable (java.util.concurrent.Callable)1 CompletionService (java.util.concurrent.CompletionService)1 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorCompletionService (java.util.concurrent.ExecutorCompletionService)1 ExecutorService (java.util.concurrent.ExecutorService)1 Future (java.util.concurrent.Future)1 LazyIterable (org.eclipse.collections.api.LazyIterable)1 ParallelIterable (org.eclipse.collections.api.ParallelIterable)1 Beta (org.eclipse.collections.api.annotation.Beta)1 MutableBag (org.eclipse.collections.api.bag.MutableBag)1 MutableSortedBag (org.eclipse.collections.api.bag.sorted.MutableSortedBag)1 Function (org.eclipse.collections.api.block.function.Function)1 Function0 (org.eclipse.collections.api.block.function.Function0)1 Function2 (org.eclipse.collections.api.block.function.Function2)1 DoubleFunction (org.eclipse.collections.api.block.function.primitive.DoubleFunction)1