List of utility methods to do Iterable Count
Iterable | count(final Iterable count Iterable<Integer> generator = new Iterable<Integer>() { public Iterator<Integer> iterator() { return new Iterator<Integer>() { Iterator<T> iter = iterable.iterator(); int currentValue = 0 - step; @Override public boolean hasNext() { return iter.hasNext(); ... |
int | count(Iterable iterable) count Iterator i = iterable.iterator();
return count(i);
|
int | count(Iterable> i) count int count = 0; Iterator<?> ii = i.iterator(); while (ii.hasNext()) { ii.next(); count++; return count; |
long | count(Iterable> iterable) Runs through an Iterable and counts the number of elements. long[] count = { 0 }; iterable.forEach(c -> count[0]++); return count[0]; |
int | count(Iterable Returns the number of elements the iterable contains. int count = 0; if (iterable != null) { Iterator<T> iter = iterable.iterator(); while (iter.hasNext()) { iter.next(); count++; return count; |