I need to figure out the number of elements in an Iterable in Java. I know I can do this:
Iterable
Iterable values = ... it = values.iterator(); while (i
Why don't you simply use the size() method on your Collection to get the number of elements?
size()
Collection
Iterator is just meant to iterate,nothing else.
Iterator