Here you can find the source of count(Iterator
Parameter | Description |
---|---|
iterator | a parameter |
public static long count(Iterator<String> iterator)
//package com.java2s; /*/* w ww . j av a2 s . com*/ * The contents of this file are subject to the license and copyright * detailed in the LICENSE and NOTICE files at the root of the source * tree and available online at * * http://duracloud.org/license/ */ import java.util.Iterator; public class Main { /** * Determines the number of elements in an iteration. * * @param iterator * @return */ public static long count(Iterator<String> iterator) { if (iterator == null) { return 0; } long count = 0; while (iterator.hasNext()) { ++count; iterator.next(); } return count; } }