Here you can find the source of getEnumeratedObjectCount(Iterator
Parameter | Description |
---|---|
T | the generic type |
objects | The objects. |
protected static <T> int getEnumeratedObjectCount(Iterator<T> objects)
//package com.java2s; import java.util.Iterator; public class Main { /**/* www. java 2s . c o m*/ * Gets the enumerated object count. * * @param <T> * the generic type * @param objects * The objects. * @return Count of objects in iterator. */ protected static <T> int getEnumeratedObjectCount(Iterator<T> objects) { int count = 0; while (objects != null && objects.hasNext()) { @SuppressWarnings("unused") Object obj = objects.next(); count++; } return count; } }