java.util.Collection
java.util.List (which extends Collection)
java.util.Set (which also extends Collection)
java.util.Map (which doesn't extend Collection)
import java.util.Collection;
import java.util.Iterator;
public class MainClass {
public static void main(String[] argv) {
System.out.println();
}
public void dumpCollection(Collection c) {
System.out.println("Collection has" + c.size() + " elements.");
Iterator iter = c.iterator();
while (iter.hasNext())
System.out.println("Next element is" + iter.next());
}
}
|