@Override public <P> int countWith(Predicate2<? super T, ? super P> predicate, P parameter) { return ListIterate.countWith(this, predicate, parameter); }
/** * Returns the total number of elements that evaluate to true for the specified predicate2 and parameter. * <p> * <pre>e.g. * return Iterate.<b>countWith</b>(lastNames, Predicates2.equal(), "Smith"); * </pre> */ public static <T, IV> int countWith( Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue) { if (iterable instanceof MutableCollection) { return ((MutableCollection<T>) iterable).countWith(predicate, injectedValue); } if (iterable instanceof ArrayList) { return ArrayListIterate.countWith((ArrayList<T>) iterable, predicate, injectedValue); } if (iterable instanceof List) { return ListIterate.countWith((List<T>) iterable, predicate, injectedValue); } if (iterable != null) { return IterableIterate.countWith(iterable, predicate, injectedValue); } throw new IllegalArgumentException("Cannot get a count from null"); }
@Override public <P> int countWith(Predicate2<? super T, ? super P> predicate, P parameter) { return ListIterate.countWith(this, predicate, parameter); }
/** * Returns the total number of elements that evaluate to true for the specified predicate2 and parameter. * <p> * <pre>e.g. * return Iterate.<b>countWith</b>(lastNames, Predicates2.equal(), "Smith"); * </pre> */ public static <T, IV> int countWith( Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue) { if (iterable instanceof MutableCollection) { return ((MutableCollection<T>) iterable).countWith(predicate, injectedValue); } if (iterable instanceof ArrayList) { return ArrayListIterate.countWith((ArrayList<T>) iterable, predicate, injectedValue); } if (iterable instanceof List) { return ListIterate.countWith((List<T>) iterable, predicate, injectedValue); } if (iterable != null) { return IterableIterate.countWith(iterable, predicate, injectedValue); } throw new IllegalArgumentException("Cannot get a count from null"); }