Here you can find the source of addAll(Collection dest, Iterator extends A> src)
public static <A> void addAll(Collection<A> dest, Iterator<? extends A> src)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Iterator; public class Main { /**//from w w w . j av a 2s. co m * Adds all the elements from an iterator to a collection. */ public static <A> void addAll(Collection<A> dest, Iterator<? extends A> src) { while (src.hasNext()) dest.add(src.next()); } }