迭代器的大小
/* You may freely copy, distribute, modify and use this class as long as the original author attribution remains intact. See message below. Copyright (C) 2003 Christian Pesch. All Rights Reserved. */ //package com.nowjava; import java.util.*; /*NowJava.com - 时代Java 提供*/ public class Main { public static int size(Iterator iterator) { int count = 0; while (iterator.hasNext()) { iterator.next(); count++; } return count; }/** NowJava.com 提供 **/ }