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
This is perhaps a bit late, but may help someone. I come across similar issue with Iterable in my codebase and solution was to use for each without explicitly calling values.iterator();.
for each
values.iterator();
int size = 0; for(T value : values) { size++; }