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.*; public class Main { /**// ww w. j a v a 2 s . 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; } }