List of utility methods to do Iterator Size
long | count(final Iterator iterator) count long ix = 0; for (; iterator.hasNext(); ++ix) iterator.next(); return ix; |
int | count(Iterator triples) count int count = 0; while (triples.hasNext()) { triples.next(); count++; return count; |
long | count(Iterator Determines the number of elements in an iteration. if (iterator == null) { return 0; long count = 0; while (iterator.hasNext()) { ++count; iterator.next(); return count; |
int | count(Iterator count if (it == null) { throw new IllegalArgumentException("it == null"); int count = 0; while (it.hasNext()) { it.next(); count++; return count; |
long | counter(final Iterator iterator) Count the number of objects in an iterator. long counter = 0; try { while (true) { iterator.next(); counter++; } catch (final NoSuchElementException e) { return counter; |
int | size(final Iterator Returns the number of elements in the iterator sequence. if (iter == null) { throw new NullPointerException(); int count = 0; while (iter.hasNext()) { iter.next(); count++; return count; |
int | size(Iterator source) Get the size of an iterator (number of items in it). int result = 0; while (source.hasNext()) { source.next(); ++result; return result; |
int | size(Iterator> iterator) Resolves the size of a given Iterator by iterating over it. int retval = 0; if (iterator != null) { for (; iterator.hasNext(); iterator.next()) { retval++; return retval; |
long | size(Iterator size long size = 0; while (iterator.hasNext()) { iterator.next(); size += 1; return size; |