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
You can cast your iterable to a list then use .size() on it.
Lists.newArrayList(iterable).size();
For the sake of clarity, the above method will require the following import:
import com.google.common.collect.Lists;