added countWithPredicate and associated Unit Tests