Java tutorial
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public static void addAll(Collection c, Iterator it) { while (it.hasNext()) { c.add(it.next()); } } }