The list of methods to do Iterator Size are organized into topic(s).
int
count(Iterator triples) count
int count = 0;
while (triples.hasNext()) {
triples.next();
count++;
return count;
long
count(Iterator 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 it) 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 iter) 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 iterator) size
long size = 0;
while (iterator.hasNext()) {
iterator.next();
size += 1;
return size;