Is there a "computationally" quick way to get the count of an iterator?
int i = 0;
for ( ; some_iterator.hasNext() ; ++i ) some_iterator.next();
... seems like a waste of CPU cycles.
Using Guava library:
int size = Iterators.size(iterator);
Internally it just iterates over all elements so its just for convenience.