Get the Number of Iterations Performed by an Iterator

Get the number of iterations that are performed by fully exhausting an Iterator.

Javadoc available at https://www.javatapas.com/docs/javatapas/util/GetIteratorCount.html


public static int getIteratorCount(Iterator iterator){

	int count = 0;

	while (iterator.hasNext()){
		iterator.next();
		count++;
	}

	return count;

}