Here you can find the source of addAll(Collection
public static <T> void addAll(Collection<T> coll, T... elems)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.Collection; import java.util.Iterator; public class Main { /**/* ww w. j a v a 2 s . co m*/ * Appends an arbitrary number of explicit elements to an existing collection. * Primarily useful when writing testcases. */ public static <T> void addAll(Collection<T> coll, T... elems) { for (T elem : elems) coll.add(elem); } /** * Appends the values returned by an iterator to the passed collection. */ public static <T> void addAll(Collection<T> coll, Iterator<T> src) { while (src.hasNext()) coll.add(src.next()); } /** * Appends the contents of an iterable object to the passed collection. */ public static <T> void addAll(Collection<T> coll, Iterable<T> src) { addAll(coll, src.iterator()); } }