Here you can find the source of size(Iterator source)
Parameter | Description |
---|---|
source | a parameter |
public static int size(Iterator source)
//package com.java2s; // License & terms of use: http://www.unicode.org/copyright.html#License import java.util.Iterator; public class Main { /**//from w w w. j a va2 s . c o m * Get the size of an iterator (number of items in it). * @param source * @return */ public static int size(Iterator source) { int result = 0; while (source.hasNext()) { source.next(); ++result; } return result; } }