*/
public static <T> Number count(Iterator<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) {
long answer = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);
while (self.hasNext()) {
if (bcw.call(self.next())) {
++answer;
}
}
// for b/c with Java return an int if we can
if (answer <= Integer.MAX_VALUE) return (int) answer;